Skip to content
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

Tracking invalid type assertions #18217

Closed
ghost opened this issue Sep 1, 2017 · 6 comments
Closed

Tracking invalid type assertions #18217

ghost opened this issue Sep 1, 2017 · 6 comments
Labels
Infrastructure Issue relates to TypeScript team infrastructure

Comments

@ghost
Copy link

ghost commented Sep 1, 2017

Before we had no-object-literal-type-assertion applied, there were a lot of suspicious casts.
These have all been labeled with comments containing the text GH#18217.

@mhegazy mhegazy added the Infrastructure Issue relates to TypeScript team infrastructure label Sep 5, 2017
@mhegazy mhegazy assigned ghost Sep 5, 2017
ajafff added a commit to ajafff/TypeScript that referenced this issue Aug 9, 2018
ghost pushed a commit that referenced this issue Aug 10, 2018
…26319)

* moduleNameResolver: fix invalid assertion and avoid unnecessary work

Part of #18217

* assert nonRelativeModuleName
@ghost ghost mentioned this issue Sep 26, 2018
@RyanCavanaugh RyanCavanaugh unassigned ghost May 22, 2019
@WORMSS
Copy link

WORMSS commented Sep 13, 2019

@edsrzf
Copy link

edsrzf commented Dec 13, 2020

I've run into an exception thrown by this line, which has a comment referencing this issue:

: (host.isKnownTypesPackageName!(packageName) ? getTypesPackageName(packageName) : undefined); // TODO: GH#18217

What's the best way to proceed? It looks like it would be relatively straightforward to add a check, but do I need to create a repro case to show it's a real issue? Should I open another issue and link to this one? Please advise.

@RyanCavanaugh
Copy link
Member

This issue was a catch-all for eventually removing every postfix !. Please open a new issue outlining how to repro the problem you encountered. Thanks!

@mjz19910
Copy link

mjz19910 commented Sep 2, 2021

got an undefined in tsserver version 4.5.20210901

/**
@type {PropType<PropType<X,'prototype'>,'get'>}
*/
var error;

when you change a character in "prototype" or "get" and wait for type inference to activate, then this error appears in the devtools in code-insiders

getTypeParametersForTypeReference return undefined, that then causes this error

Cannot read property '1' of undefined
TypeError: Cannot read property '1' of undefined
at getTypeArgumentConstraint (c:\Users\matth.vscode-insiders\extensions\ms-vscode.vscode-typescript-next-4.5.20210901\node_modules\typescript\lib\tsserver.js:76890:73)
at Object.getTypeArgumentConstraint (c:\Users\matth.vscode-insiders\extensions\ms-vscode.vscode-typescript-next-4.5.20210901\node_modules\typescript\lib\tsserver.js:46205:32)
at getStringLiteralCompletionEntries (c:\Users\matth.vscode-insiders\extensions\ms-vscode.vscode-typescript-next-4.5.20210901\node_modules\typescript\lib\tsserver.js:125267:108)
at Object.getStringLiteralCompletions (c:\Users\matth.vscode-insiders\extensions\ms-vscode.vscode-typescript-next-4.5.20210901\node_modules\typescript\lib\tsserver.js:125173:35)

DanielRosenwasser added a commit that referenced this issue Jan 20, 2022
* Update to TypeScript 4.5.5, fix semantic lints.

* Remove extra parens.

* Remove now-outdated non-null comment around #18217.
@dannymcgee
Copy link

It looks like custom transformers (at least those hooked into the before phase) can't successfully create new get/set accessor nodes due to an invalid non-null assertion at the very top of compiler > checker > createTypeChecker > createResolver > getAllAccessorDeclarations. Reproduced in 4.8.4, but the assertion is still there on main currently.

@jakebailey
Copy link
Member

@dannymcgee Would you mind filing a new issue for that, especially if you have a simple transformer that shows the bug? We can add those as unit tests.

(As with #18217 (comment) this issue isn't really the right place to report isuses.)

@microsoft microsoft locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Infrastructure Issue relates to TypeScript team infrastructure
Projects
None yet
Development

No branches or pull requests

7 participants