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
Internal crash with TypeError: Cannot read properties of undefined (reading 'parent')
#57582
Comments
It might be quite hard to investigate this without a repro case. Would you be able to reduce your repository to one? |
Don't think so, it is a huge private repository |
Wild guess, but I bet it has to do with: /**
* When consuming an iterable type in a for..of, spread, or iterator destructuring assignment
* we want to get the iterated type of an iterable for ES2015 or later, or the iterated type
* of a iterable (if defined globally) or element type of an array like for ES2015 or earlier.
*/
function getIteratedTypeOrElementType(use: IterationUse, inputType: Type, sentType: Type, errorNode: Node | undefined, checkAssignability: boolean): Type | undefined {
const allowAsyncIterables = (use & IterationUse.AllowsAsyncIterablesFlag) !== 0;
if (inputType === neverType) {
reportTypeNotIterableError(errorNode!, inputType, allowAsyncIterables); // TODO: GH#18217
return undefined;
} Note |
I have found what was causing the issue for us (valid js file with buggy implementation |
Yeah, this is an error path, so it's crashing instead of telling you about said bug, I would assume. |
I think it is valid js (destructuring), and we had no issues reported in previous typescript versions. But if I remove the destructuring (or set the file to |
It's valid JS, it's just code which fails to typecheck and would error but instead crashes. |
managed to create a reproduction! |
🔎 Search Terms
Project works fine with typescript version
4.8.4
, when upgrading to4.9.4
(and any further version) type checking crashes with an internal error.🕗 Version & Regression Information
typescript@next
(Version 5.5.0-dev.20240229
)With the help of every-ts bisect I found the first bad commit to be:
https://github.com/microsoft/TypeScript/pull/50623/files
I think error might come from
errorNode
being undefined here:⏯ Playground Link
No response
💻 Code
No response
🙁 Actual behavior
🙂 Expected behavior
no internal crash when upgrading versions
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: