Skip to content

Replace addUndefined in serializeTypeForDeclaration with the actual declaration #58085

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
128 changes: 93 additions & 35 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/compiler/transformers/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ export function transformDeclarations(context: TransformationContext) {
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.BindingElement:
case SyntaxKind.VariableDeclaration:
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldAddImplicitUndefined);
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need shouldAddImplicitUndefined at this point? I did a diff locally forcing it to false above and it was... almost clean. So I think the answer is "yes" until we fix parameter properties and hopefully our goofy rules about optionalish/requiredish parameters...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need shouldAddImplicitUndefined at this point?

Ultimately, I would like to remove it and the EmitResolver API backing it - for me, that was what motivated basically this whole stack of changes (quite literally: I removed it, and then started seeing what needed to be done to minimize the diffs). There's a bit more work to be done to minimize that diff, though - mostly, from what I can tell, around handling errors and duplicated declarations (with structurally-identical-but-identity-unique types) in the node builder more like the top-level declaration emitter does today.

Copy link
Member Author

@weswigham weswigham Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think the answer is "yes" until we fix parameter properties and hopefully our goofy rules about optionalish/requiredish parameters...

Ah, you want to lock it to true, not false, that way it always falls back to the logic within createTypeOfDeclaration (which handles optional properties/parameters), rather than the declaration emitter's visitDeclarationSubtree (which doesn't) - that'll be more representative of what needs to be fixed in the node builder to remove the API.

Copy link
Member

@jakebailey jakebailey Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant false in the code above (I couldn't highlight it in the diff, thanks GitHub), such that type && !shouldAddImplicitUndefined is true and we just copy the nodes (so, more reuse).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant false in the code above (I couldn't highlight it in the diff, thanks GitHub), such that type && !shouldAddImplicitUndefined is true and we just copy the nodes (so, more reuse).

Yeah, exactly, at no point have I changed this case in this or any recent PR, however. The visitDeclarationSubtree codepath always copies nodes, without regard for type information that may indicate otherwise. That's right enough most of the time, without considering the shouldAddImplicitUndefined carve-out. What we care about, IMO, is if the fallback createTypeOfDeclaration calls also always copy the input nodes when they can - because if they do, the entire

if (type && !shouldAddImplicitUndefined) {
    return visitNode(type, visitDeclarationSubtree, context);
}

branch can be removed, as createTypeOfDeclaration will internally have all the same logic (and it needs to anyway, in order to handle copying subtrees of input nodes within the nodes it generates). After this change, the only issues blocking that, AFAIK, are that createTypeOfDeclaration over-invalidates in the presence of an error type/structurally identical types across multiple declarations, and discards input nodes it could probably safely reuse.

break;
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.ConstructSignature:
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5653,7 +5653,7 @@ export interface EmitResolver {
requiresAddingImplicitUndefined(node: ParameterDeclaration): boolean;
isExpandoFunctionDeclaration(node: FunctionDeclaration): boolean;
getPropertiesOfContainerFunction(node: Declaration): Symbol[];
createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined;
createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined;
createReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined;
createTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined;
createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, tracker: SymbolTracker): Expression;
Expand Down
50 changes: 25 additions & 25 deletions tests/baselines/reference/1.0lib-noErrors.types

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/baselines/reference/2dArrays.types
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class Board {
>this.ships.every(function (val) { return val.isSunk; }) : boolean
> : ^^^^^^^
>this.ships.every : { <S extends Ship>(predicate: (value: Ship, index: number, array: Ship[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Ship, index: number, array: Ship[]) => unknown, thisArg?: any): boolean; }
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^
>this.ships : Ship[]
> : ^^^^^^
>this : this
> : ^^^^
>ships : Ship[]
> : ^^^^^^
>every : { <S extends Ship>(predicate: (value: Ship, index: number, array: Ship[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Ship, index: number, array: Ship[]) => unknown, thisArg?: any): boolean; }
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^
>function (val) { return val.isSunk; } : (val: Ship) => boolean
> : ^ ^^^^^^^^^^^^^^^^^^
>val : Ship
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ module clodule {
>clodule.sfn('a') : number
> : ^^^^^^
>clodule.sfn : (id: string) => number
> : ^ ^^^^^^^^^^^^^^^^^^^
> : ^ ^^ ^^^^^^^^^^^
>clodule : typeof clodule
> : ^^^^^^^^^^^^^^
>sfn : (id: string) => number
> : ^ ^^^^^^^^^^^^^^^^^^^
> : ^ ^^ ^^^^^^^^^^^
>'a' : "a"
> : ^^^
}
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of1.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ for (var v of ['a', 'b', 'c']) {
>console.log(v) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>v : string
> : ^^^^^^
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of22.types
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ for (var x of [1, 2, 3]) {
>console.log(x) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>x : number
> : ^^^^^^
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of23.types
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ for (var x of [1, 2, 3]) {
>console.log(x) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>x : number
> : ^^^^^^
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of33.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ for (var v of ['a', 'b', 'c']) {
>console.log(v) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>v : string
> : ^^^^^^
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/ES5For-of37.types
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ for (const i of [0, 1, 2, 3, 4]) {
>console.log(i) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>i : number
> : ^^^^^^

Expand All @@ -69,11 +69,11 @@ for (const i of [0, 1, 2, 3, 4]) {
>console.log('E %s %s', i, err) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>'E %s %s' : "E %s %s"
> : ^^^^^^^^^
>i : number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ var fn: (s: string) => boolean;

var fn = A.fn;
>fn : (s: string) => boolean
> : ^ ^^^^^^^^^^^^^^^^^^^^
> : ^ ^^ ^^^^^^^^^^^^
>A.fn : (s: string) => boolean
> : ^ ^^^^^^^^^^^^^^^^^^^^
> : ^ ^^ ^^^^^^^^^^^^
>A : typeof A
> : ^^^^^^^^
>fn : (s: string) => boolean
> : ^ ^^^^^^^^^^^^^^^^^^^^
> : ^ ^^ ^^^^^^^^^^^^

var fng: <T, U>(s: T) => U;
>fng : <T, U>(s: T) => U
Expand All @@ -71,13 +71,13 @@ var fng: <T, U>(s: T) => U;

var fng = A.fng; // bug 838015
>fng : <T, U>(s: T) => U
> : ^^^^^^^ ^^^^^^^^^
> : ^ ^^^^^ ^^ ^^^^^^
>A.fng : <T, U>(s: T) => U
> : ^^^^^^^ ^^^^^^^^^
> : ^ ^^^^^ ^^ ^^^^^^
>A : typeof A
> : ^^^^^^^^
>fng : <T, U>(s: T) => U
> : ^^^^^^^ ^^^^^^^^^
> : ^ ^^^^^ ^^ ^^^^^^

// these should be errors since the functions are not exported
var fn2 = A.fn2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var l: { new (s: A.Point, e: A.Point); }

var l: X.Y.Z.Line;
>l : new (s: A.Point, e: A.Point) => any
> : ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
> : ^^^^^ ^^ ^^ ^^ ^^^^^^^^
>X : any
> : ^^^
>Y : any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ var o = A.Utils.mirror(o);
>A.Utils.mirror(o) : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>A.Utils.mirror : <T extends A.Point>(p: T) => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>A.Utils : typeof A.Utils
> : ^^^^^^^^^^^^^^
>A : typeof A
> : ^^^^^^^^
>Utils : typeof A.Utils
> : ^^^^^^^^^^^^^^
>mirror : <T extends A.Point>(p: T) => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>o : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var l: { start: A.Point; end: A.Point; new (s: A.Point, e: A.Point); }

var l: X.Y.Z.Line;
>l : { new (s: A.Point, e: A.Point): any; start: A.Point; end: A.Point; }
> : ^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^^^^^^^ ^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>X : any
> : ^^^
>Y : any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ var o = A.Utils.mirror(o);
>A.Utils.mirror(o) : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^
>A.Utils.mirror : <T extends A.Point>(p: T) => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>A.Utils : typeof A.Utils
> : ^^^^^^^^^^^^^^
>A : typeof A
> : ^^^^^^^^
>Utils : typeof A.Utils
> : ^^^^^^^^^^^^^^
>mirror : <T extends A.Point>(p: T) => { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> : ^ ^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>o : { x: number; y: number; }
> : ^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
16 changes: 8 additions & 8 deletions tests/baselines/reference/abstractClassUnionInstantiation.types
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ new cls3(); // should work
>[ConcreteA, AbstractA, AbstractB].map(cls => new cls()) : any[]
> : ^^^^^
>[ConcreteA, AbstractA, AbstractB].map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[ConcreteA, AbstractA, AbstractB] : (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>ConcreteA : typeof ConcreteA
Expand All @@ -85,7 +85,7 @@ new cls3(); // should work
>AbstractB : typeof AbstractB
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof ConcreteA | typeof AbstractA | typeof AbstractB) => any
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof ConcreteA | typeof AbstractA | typeof AbstractB
Expand All @@ -99,7 +99,7 @@ new cls3(); // should work
>[AbstractA, AbstractB, ConcreteA].map(cls => new cls()) : any[]
> : ^^^^^
>[AbstractA, AbstractB, ConcreteA].map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[AbstractA, AbstractB, ConcreteA] : (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>AbstractA : typeof AbstractA
Expand All @@ -109,7 +109,7 @@ new cls3(); // should work
>ConcreteA : typeof ConcreteA
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof ConcreteA | typeof AbstractA | typeof AbstractB, index: number, array: (typeof ConcreteA | typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof ConcreteA | typeof AbstractA | typeof AbstractB) => any
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof ConcreteA | typeof AbstractA | typeof AbstractB
Expand All @@ -123,15 +123,15 @@ new cls3(); // should work
>[ConcreteA, ConcreteB].map(cls => new cls()) : ConcreteA[]
> : ^^^^^^^^^^^
>[ConcreteA, ConcreteB].map : <U>(callbackfn: (value: typeof ConcreteA, index: number, array: (typeof ConcreteA)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[ConcreteA, ConcreteB] : (typeof ConcreteA)[]
> : ^^^^^^^^^^^^^^^^^^^^
>ConcreteA : typeof ConcreteA
> : ^^^^^^^^^^^^^^^^
>ConcreteB : typeof ConcreteB
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof ConcreteA, index: number, array: (typeof ConcreteA)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof ConcreteA) => ConcreteA
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof ConcreteA
Expand All @@ -145,15 +145,15 @@ new cls3(); // should work
>[AbstractA, AbstractB].map(cls => new cls()) : any[]
> : ^^^^^
>[AbstractA, AbstractB].map : <U>(callbackfn: (value: typeof AbstractA | typeof AbstractB, index: number, array: (typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>[AbstractA, AbstractB] : (typeof AbstractA | typeof AbstractB)[]
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>AbstractA : typeof AbstractA
> : ^^^^^^^^^^^^^^^^
>AbstractB : typeof AbstractB
> : ^^^^^^^^^^^^^^^^
>map : <U>(callbackfn: (value: typeof AbstractA | typeof AbstractB, index: number, array: (typeof AbstractA | typeof AbstractB)[]) => U, thisArg?: any) => U[]
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
> : ^^^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^
>cls => new cls() : (cls: typeof AbstractA | typeof AbstractB) => any
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>cls : typeof AbstractA | typeof AbstractB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ abstract class A {
>console.log(this.x) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>this.x : string
> : ^^^^^^
>this : this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ abstract class A {
>console.log(this.x) : void
> : ^^^^
>console.log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>console : Console
> : ^^^^^^^
>log : (...data: any[]) => void
> : ^^^^ ^^^^^^^^^^^^^^^^
> : ^^^^ ^^ ^^^^^^^^^
>this.x : string
> : ^^^^^^
>this : this
Expand Down
Loading