Skip to content

Commit f89a5fd

Browse files
authored
Replace addUndefined in serializeTypeForDeclaration with the actual declaration (#58085)
1 parent 066773b commit f89a5fd

File tree

2,867 files changed

+31191
-31066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,867 files changed

+31191
-31066
lines changed

src/compiler/checker.ts

Lines changed: 93 additions & 35 deletions
Large diffs are not rendered by default.

src/compiler/transformers/declarations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ export function transformDeclarations(context: TransformationContext) {
638638
case SyntaxKind.PropertyDeclaration:
639639
case SyntaxKind.BindingElement:
640640
case SyntaxKind.VariableDeclaration:
641-
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldAddImplicitUndefined);
641+
typeNode = resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
642642
break;
643643
case SyntaxKind.FunctionDeclaration:
644644
case SyntaxKind.ConstructSignature:

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5653,7 +5653,7 @@ export interface EmitResolver {
56535653
requiresAddingImplicitUndefined(node: ParameterDeclaration): boolean;
56545654
isExpandoFunctionDeclaration(node: FunctionDeclaration): boolean;
56555655
getPropertiesOfContainerFunction(node: Declaration): Symbol[];
5656-
createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker, addUndefined?: boolean): TypeNode | undefined;
5656+
createTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration | PropertyAccessExpression | ElementAccessExpression | BinaryExpression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined;
56575657
createReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined;
56585658
createTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: NodeBuilderFlags, tracker: SymbolTracker): TypeNode | undefined;
56595659
createLiteralConstValue(node: VariableDeclaration | PropertyDeclaration | PropertySignature | ParameterDeclaration, tracker: SymbolTracker): Expression;

tests/baselines/reference/1.0lib-noErrors.types

Lines changed: 25 additions & 25 deletions
Large diffs are not rendered by default.

tests/baselines/reference/2dArrays.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ class Board {
3535
>this.ships.every(function (val) { return val.isSunk; }) : boolean
3636
> : ^^^^^^^
3737
>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; }
38-
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
38+
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^
3939
>this.ships : Ship[]
4040
> : ^^^^^^
4141
>this : this
4242
> : ^^^^
4343
>ships : Ship[]
4444
> : ^^^^^^
4545
>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; }
46-
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
46+
> : ^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^
4747
>function (val) { return val.isSunk; } : (val: Ship) => boolean
4848
> : ^ ^^^^^^^^^^^^^^^^^^
4949
>val : Ship

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ module clodule {
3939
>clodule.sfn('a') : number
4040
> : ^^^^^^
4141
>clodule.sfn : (id: string) => number
42-
> : ^ ^^^^^^^^^^^^^^^^^^^
42+
> : ^ ^^ ^^^^^^^^^^^
4343
>clodule : typeof clodule
4444
> : ^^^^^^^^^^^^^^
4545
>sfn : (id: string) => number
46-
> : ^ ^^^^^^^^^^^^^^^^^^^
46+
> : ^ ^^ ^^^^^^^^^^^
4747
>'a' : "a"
4848
> : ^^^
4949
}

tests/baselines/reference/ES5For-of1.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ for (var v of ['a', 'b', 'c']) {
1717
>console.log(v) : void
1818
> : ^^^^
1919
>console.log : (...data: any[]) => void
20-
> : ^^^^ ^^^^^^^^^^^^^^^^
20+
> : ^^^^ ^^ ^^^^^^^^^
2121
>console : Console
2222
> : ^^^^^^^
2323
>log : (...data: any[]) => void
24-
> : ^^^^ ^^^^^^^^^^^^^^^^
24+
> : ^^^^ ^^ ^^^^^^^^^
2525
>v : string
2626
> : ^^^^^^
2727
}

tests/baselines/reference/ES5For-of22.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ for (var x of [1, 2, 3]) {
2323
>console.log(x) : void
2424
> : ^^^^
2525
>console.log : (...data: any[]) => void
26-
> : ^^^^ ^^^^^^^^^^^^^^^^
26+
> : ^^^^ ^^ ^^^^^^^^^
2727
>console : Console
2828
> : ^^^^^^^
2929
>log : (...data: any[]) => void
30-
> : ^^^^ ^^^^^^^^^^^^^^^^
30+
> : ^^^^ ^^ ^^^^^^^^^
3131
>x : number
3232
> : ^^^^^^
3333
}

tests/baselines/reference/ES5For-of23.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ for (var x of [1, 2, 3]) {
2323
>console.log(x) : void
2424
> : ^^^^
2525
>console.log : (...data: any[]) => void
26-
> : ^^^^ ^^^^^^^^^^^^^^^^
26+
> : ^^^^ ^^ ^^^^^^^^^
2727
>console : Console
2828
> : ^^^^^^^
2929
>log : (...data: any[]) => void
30-
> : ^^^^ ^^^^^^^^^^^^^^^^
30+
> : ^^^^ ^^ ^^^^^^^^^
3131
>x : number
3232
> : ^^^^^^
3333
}

tests/baselines/reference/ES5For-of33.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ for (var v of ['a', 'b', 'c']) {
1717
>console.log(v) : void
1818
> : ^^^^
1919
>console.log : (...data: any[]) => void
20-
> : ^^^^ ^^^^^^^^^^^^^^^^
20+
> : ^^^^ ^^ ^^^^^^^^^
2121
>console : Console
2222
> : ^^^^^^^
2323
>log : (...data: any[]) => void
24-
> : ^^^^ ^^^^^^^^^^^^^^^^
24+
> : ^^^^ ^^ ^^^^^^^^^
2525
>v : string
2626
> : ^^^^^^
2727
}

0 commit comments

Comments
 (0)