Skip to content

Tracking invalid type assertions #18217

Closed

Description

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.

Activity

  1. edsrzf commented on Dec 13, 2020

    @edsrzf

    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.

  2. RyanCavanaugh commented on Dec 14, 2020

    @RyanCavanaugh
    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!

  3. mjz19910 commented on Sep 2, 2021

    @mjz19910

    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)

  4. dannymcgee commented on Feb 17, 2023

    @dannymcgee

    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.

  5. jakebailey commented on Feb 17, 2023

    @jakebailey
    Member

    Danny McGee (@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.)

  6. locked as resolved and limited conversation to collaborators on Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    InfrastructureIssue relates to TypeScript team infrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions