-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Cannot read property 'flags' of undefined TypeError when running tsc using 3.7.0-beta #34481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also having this problem when try to generate dts for package matrix-js-sdk with the tsconfig: Version 3.7.0-dev.20191017 {
"compilerOptions": {
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"allowJs": true /* Allow javascript files to be compiled. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
"declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
} |
it's working on Version 3.7.0-dev.20190816 but not working on Version 3.7.0-dev.20190820 |
I’m not able to repro @PissedCapslock’s example at all. @Jack-Works’ example, interestingly, repros on 3.7.0-dev.20190820 as mentioned, works on 3.7.0-dev.20191017, but then crashes with the same error if you turn |
Actually, @Jack-Works, the error I can reproduce in your repo is |
I think get the same exception stack as the @PissedCapslock one |
@andrewbranch You are right. It cannot be reproduced with the code in the issue description. I slightly modified the code after posting the issue, and that resolved the bug. If you remove the following lines again:
you can reproduce the issue. Of course, one can argue that the JS is not correct at that point and that I should fix my JS first :-) . To make it as easy as possible to reproduce, you can run the following commands:
But not sure if this issue is still worth your time, seeing as I made an error in the Javascript. The only thing that would be nice is a better error message from |
Indeed, I can reproduce it now. Thanks! |
Minimal-ish repro: function Graphic() {
}
Object.defineProperty(Graphic.prototype, "inlineContent", {
get: function() {
return this.x;
}
}); And note a workaround is to tag
It’s true that your JS doesn’t check, but the reason we didn’t give you a proper error message is because we crashed during compilation. That’s never acceptable, regardless of how wrong your input is. We should be able to give you a good error message if you tried to compile the contents of A Tale of Two Cities, so we should certainly be able to handle almost-correct JavaScript. |
Thanks Andrew. Very nice to see how fast this bug went from being reported to being fixed. |
Quick question on this because I feel like I may be seeing something similar. Basically, I'm running into an issue from a custom downloaded portion of Highcharts. I think what's happening is the code has: // ...
function extend(a, b) {
/* eslint-enable valid-jsdoc */
var n;
if (!a) {
a = {};
}
for (n in b) { // eslint-disable-line guard-for-in
a[n] = b[n];
}
return a;
}
// ...
var Chart = H.Chart = function () {
this.getArgs.apply(this, arguments);
};
// ...
extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
// Hook for adding callbacks in modules
callbacks: [],
// ... And I'm getting
Am I running into the same error as above but because Highcharts uses a hand-rolled /** @constructor */
var Chart = H.Chart = function () { /** @constructor */
this.getArgs.apply(this, arguments);
}; but neither of those worked. EditIs it supposed to be /** @constructs Chart*/
var Chart = H.Chart = function () {
this.getArgs.apply(this, arguments);
}; Edit2That seems to have fixed it |
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 3.7.0-dev.20191015
Search Terms:
getFlowTypeOfReference
Code
Project structure:
where
package.json
isand
tsconfig.json
isand
Graphic.js
a JS file which still uses AMD modulesRunning the
tsc
command produces an error.Expected behavior:
The Typescript compiler can finish compilation without crashing
Actual behavior:
Typescript compiler threw an error
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: