Skip to content

Crash on extract to type alias #40609

@DanielRosenwasser

Description

@DanielRosenwasser
type WatchedEventListener<T> = {
    addEventListener:
        keyof T extends string ?
            [|(eventName: `${keyof T}Changed`, callback: (propName: keyof T) => void) => void|] :
            never;
};

Extract type alias at the above [|range|].

<semantic> TypeScript Server Error (4.1.0-insiders.20200829)
Debug Failure. False expression: Token end is child end
Error: Debug Failure. False expression: Token end is child end
    at processChildNode (\node_modules\TypeScript\lib\tsserver.js:130013:38)
    at \node_modules\TypeScript\lib\tsserver.js:129945:21
    at visitNode (\node_modules\TypeScript\lib\tsserver.js:27435:24)
    at Object.forEachChild (\node_modules\TypeScript\lib\tsserver.js:27498:21)
    at processNode (\node_modules\TypeScript\lib\tsserver.js:129944:20)
    at processChildNode (\node_modules\TypeScript\lib\tsserver.js:130020:21)
    at processChildNodes (\node_modules\TypeScript\lib\tsserver.js:130083:48)
    at \node_modules\TypeScript\lib\tsserver.js:129947:21
    at visitNodes (\node_modules\TypeScript\lib\tsserver.js:27440:24)
    at Object.forEachChild (\node_modules\TypeScript\lib\tsserver.js:27545:21)
    at processNode (\node_modules\TypeScript\lib\tsserver.js:129944:20)
    at processChildNode (\node_modules\TypeScript\lib\tsserver.js:130020:21)
    at \node_modules\TypeScript\lib\tsserver.js:129945:21
    at visitNode (\node_modules\TypeScript\lib\tsserver.js:27435:24)
    at Object.forEachChild (\node_modules\TypeScript\lib\tsserver.js:27769:21)
    at processNode (\node_modules\TypeScript\lib\tsserver.js:129944:20)
    at formatSpanWorker (\node_modules\TypeScript\lib\tsserver.js:129757:17)
    at \node_modules\TypeScript\lib\tsserver.js:129721:140
    at Object.getFormattingScanner (\node_modules\TypeScript\lib\tsserver.js:128344:23)
    at Object.formatNodeGivenIndentation (\node_modules\TypeScript\lib\tsserver.js:129721:31)
    at getFormattedTextOfNode (\node_modules\TypeScript\lib\tsserver.js:131949:45)
    at format (\node_modules\TypeScript\lib\tsserver.js:131919:52)
    at computeNewText (\node_modules\TypeScript\lib\tsserver.js:131922:23)
    at \node_modules\TypeScript\lib\tsserver.js:131887:39
    at Object.mapDefined (\node_modules\TypeScript\lib\tsserver.js:610:30)
    at \node_modules\TypeScript\lib\tsserver.js:131885:42
    at Object.mapDefined (\node_modules\TypeScript\lib\tsserver.js:610:30)
    at Object.getTextChangesFromChanges (\node_modules\TypeScript\lib\tsserver.js:131871:27)
    at ChangeTracker.getChanges (\node_modules\TypeScript\lib\tsserver.js:131839:45)
    at Function.ChangeTracker.with (\node_modules\TypeScript\lib\tsserver.js:131287:32)
    at Object.getEditsForAction (\node_modules\TypeScript\lib\tsserver.js:142337:62)
    at Object.getEditsForRefactor (\node_modules\TypeScript\lib\tsserver.js:132523:41)
    at Proxy.getEditsForRefactor (\node_modules\TypeScript\lib\tsserver.js:146187:32)
    at IOSession.Session.getEditsForRefactor (\node_modules\TypeScript\lib\tsserver.js:156565:59)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (\node_modules\TypeScript\lib\tsserver.js:155308:61)
    at \node_modules\TypeScript\lib\tsserver.js:156910:88
    at IOSession.Session.executeWithRequestId (\node_modules\TypeScript\lib\tsserver.js:156901:28)
    at IOSession.Session.executeCommand (\node_modules\TypeScript\lib\tsserver.js:156910:33)
    at IOSession.Session.onMessage (\node_modules\TypeScript\lib\tsserver.js:156934:35)
    at Interface.<anonymous> (\node_modules\TypeScript\lib\tsserver.js:159150:27)
    at Interface.emit (events.js:223:5)
    at Interface._onLine (readline.js:315:10)
    at Interface._normalWrite (readline.js:460:12)
    at Socket.ondata (readline.js:172:10)
    at Socket.emit (events.js:223:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputDomain: LS: Refactoringse.g. extract to constant or function, rename symbolEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions