Skip to content

'Extract type' from property signature with erroneous initializer causes assertion failure #52751

Closed
@DanielRosenwasser

Description

@DanielRosenwasser
type Foo = [|{
    x: string = someString;
}|]

Request an "extract to type alias" refactoring on the specified [|range|]:

 Debug Failure. False expression: Token end is child end
Error: Debug Failure. False expression: Token end is child end
    at processChildNode (typescript/lib/tsserver.js:165873:17)
    at typescript/lib/tsserver.js:165804:9
    at visitNode2 (typescript/lib/tsserver.js:29284:18)
    at forEachChildInPropertySignature (typescript/lib/tsserver.js:29340:167)
    at forEachChild (typescript/lib/tsserver.js:29798:35)
    at processNode (typescript/lib/tsserver.js:165801:5)
    at processChildNode (typescript/lib/tsserver.js:165880:7)
    at processChildNodes (typescript/lib/tsserver.js:165923:32)
    at typescript/lib/tsserver.js:165817:9
    at visitNodes (typescript/lib/tsserver.js:29289:14)
    at forEachChildInTypeLiteral (typescript/lib/tsserver.js:29399:12)
    at forEachChild (typescript/lib/tsserver.js:29798:35)
    at processNode (typescript/lib/tsserver.js:165801:5)
    at processChildNode (typescript/lib/tsserver.js:165880:7)
    at typescript/lib/tsserver.js:165804:9
    at visitNode2 (typescript/lib/tsserver.js:29284:18)
    at forEachChildInTypeAliasDeclaration (typescript/lib/tsserver.js:29575:144)
    at forEachChild (typescript/lib/tsserver.js:29798:35)
    at processNode (typescript/lib/tsserver.js:165801:5)
    at formatSpanWorker (typescript/lib/tsserver.js:165609:5)
    at typescript/lib/tsserver.js:165549:105
    at getFormattingScanner (typescript/lib/tsserver.js:164365:15)
    at Object.formatNodeGivenIndentation (typescript/lib/tsserver.js:165549:10)
    at getFormattedTextOfNode (typescript/lib/tsserver.js:163762:43)
    at format (typescript/lib/tsserver.js:163742:27)
    at computeNewText (typescript/lib/tsserver.js:163743:219)
    at typescript/lib/tsserver.js:163704:25
    at mapDefined (typescript/lib/tsserver.js:2627:22)
    at typescript/lib/tsserver.js:163702:28
    at mapDefined (typescript/lib/tsserver.js:2627:22)
    at Object.getTextChangesFromChanges (typescript/lib/tsserver.js:163696:12)
    at ChangeTracker.getChanges (typescript/lib/tsserver.js:163585:35)
    at ChangeTracker.with (typescript/lib/tsserver.js:163083:20)
    at Object.getRefactorEditsToExtractType [as getEditsForAction] (typescript/lib/tsserver.js:156988:60)
    at Object.getEditsForRefactor (typescript/lib/tsserver.js:156469:31)
    at Object.getEditsForRefactor2 [as getEditsForRefactor] (typescript/lib/tsserver.js:135592:32)
    at IpcIOSession.getEditsForRefactor (typescript/lib/tsserver.js:178779:49)
    at getEditsForRefactor (typescript/lib/tsserver.js:177034:43)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do thisOld-Crawler-DetectedDetected by an older crawler (aka "fuzzer") running random TSServer operations on public code.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions