Skip to content

Invalid cast for code fix on index signatures #47788

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Repro for #38059

let x: {
    [p: ""]: string;
}

Request code fixes

[Trace  - 21:49:43.438] <semantic> Response received: getCodeFixes (2079). Request took 6 ms. Success: false . Message: Error processing request. Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isTypeAliasDeclaration'.
Error: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isTypeAliasDeclaration'.
    at Object.cast ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:1507:25)
    at getInfo ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:153707:107)
    at Object.getCodeActions ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:153688:28)
    at [WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:145528:77
    at Object.flatMap ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:522:25)
    at Object.getFixes ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:145528:23)
    at [WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:160396:35
    at Object.flatMap ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:522:25)
    at Object.getCodeFixesAtPosition ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:160394:23)
    at IOSession.Session.getCodeFixes ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:171882:64)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:170518:61)
    at [WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:172195:88
    at IOSession.Session.executeWithRequestId ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:172186:28)
    at IOSession.Session.executeCommand ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:172195:33)
    at IOSession.Session.onMessage ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:172221:35)
    at Interface.<anonymous> ([WORKSPACE_DIR]\node_modules\typescript\lib\tsserver.js:174826:31)
    at Interface.emit (events.js:315:20)
    at Interface._onLine (readline.js:337:10)
    at Interface._normalWrite (readline.js:482:12)
    at Socket.ondata (readline.js:194:10)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: Quick FixesEditor-provided fixes, often called code actions.Effort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions