Skip to content

Arguably improve declaration emit in two ways: #48491

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

Closed
wants to merge 8 commits into from
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4370,6 +4370,9 @@ namespace ts {
return [symbol!];
}
}
if (meaning !== SymbolFlags.Value && symbolFromSymbolTable.flags & SymbolFlags.TypeAlias && isAccessible(symbolFromSymbolTable, getDeclaredTypeOfTypeAlias(symbolFromSymbolTable).symbol)) {
return [symbolFromSymbolTable];
}
});

// If there's no result and we're looking at the global symbol table, treat `globalThis` like an alias and try to lookup thru that
Expand Down Expand Up @@ -5866,9 +5869,6 @@ namespace ts {
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
parameterType = getOptionalType(parameterType);
}
if ((context.flags & NodeBuilderFlags.NoUndefinedOptionalParameterType) && parameterDeclaration && !isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
parameterType = getTypeWithFacts(parameterType, TypeFacts.NEUndefined);
}
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);

const modifiers = !(context.flags & NodeBuilderFlags.OmitParameterModifiers) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(factory.cloneNode) : undefined;
Expand Down Expand Up @@ -6495,7 +6495,7 @@ namespace ts {
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
// try to reuse the existing annotation
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation)!;
if (getTypeFromTypeNode(existing) === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
const result = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
if (result) {
return result;
Expand All @@ -6513,6 +6513,17 @@ namespace ts {
return result;
}

function typeNodeIsEquivalentToType(typeNode: TypeNode, annotatedDeclaration: Declaration, type: Type) {
const typeFromTypeNode = getTypeFromTypeNode(typeNode);
if (typeFromTypeNode === type) {
return true;
}
if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
return getTypeWithFacts(type, TypeFacts.NEUndefined) === typeFromTypeNode;
}
return false;
}

function serializeReturnTypeForSignature(context: NodeBuilderContext, type: Type, signature: Signature, includePrivateSymbol?: (s: Symbol) => void, bundled?: boolean) {
if (!isErrorType(type) && context.enclosingDeclaration) {
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
Expand Down Expand Up @@ -42445,12 +42456,6 @@ namespace ts {
hasSyntacticModifier(parameter, ModifierFlags.ParameterPropertyModifier);
}

function isOptionalUninitializedParameter(parameter: ParameterDeclaration) {
return !!strictNullChecks &&
isOptionalParameter(parameter) &&
!parameter.initializer;
}

function isExpandoFunctionDeclaration(node: Declaration): boolean {
const declaration = getParseTreeNode(node, isFunctionDeclaration);
if (!declaration) {
Expand Down
1 change: 0 additions & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4488,7 +4488,6 @@ namespace ts {
UseAliasDefinedOutsideCurrentScope = 1 << 14, // Allow non-visible aliases
UseSingleQuotesForStringLiteralType = 1 << 28, // Use single quotes for string literal type
NoTypeReduction = 1 << 29, // Don't call getReducedType
NoUndefinedOptionalParameterType = 1 << 30, // Do not add undefined to optional parameter type

// Error handling
AllowThisInObjectLiteral = 1 << 15,
Expand Down
4 changes: 4 additions & 0 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7655,4 +7655,8 @@ namespace ts {

return state > States.NodeModules ? { topLevelNodeModulesIndex, topLevelPackageNameIndex, packageRootIndex, fileNameIndex } : undefined;
}

export function getParameterTypeNode(parameter: ParameterDeclaration | JSDocParameterTag) {
return parameter.kind === SyntaxKind.JSDocParameterTag ? parameter.typeExpression?.type : parameter.type;
}
}
2 changes: 1 addition & 1 deletion src/services/codefixes/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace ts.codefix {
const program = context.program;
const checker = program.getTypeChecker();
const scriptTarget = getEmitScriptTarget(program.getCompilerOptions());
const flags = NodeBuilderFlags.NoTruncation | NodeBuilderFlags.NoUndefinedOptionalParameterType | NodeBuilderFlags.SuppressAnyReturnType | (quotePreference === QuotePreference.Single ? NodeBuilderFlags.UseSingleQuotesForStringLiteralType : 0);
const flags = NodeBuilderFlags.NoTruncation | NodeBuilderFlags.SuppressAnyReturnType | (quotePreference === QuotePreference.Single ? NodeBuilderFlags.UseSingleQuotesForStringLiteralType : 0);
const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)) as ArrowFunction | FunctionExpression | MethodDeclaration;
if (!signatureDeclaration) {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== tests/cases/compiler/DeclarationErrorsNoEmitOnError.ts ===
type T = { x : number }
>T : Symbol(T, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 0))
>x : Symbol(x, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 10))
>x : Symbol(T.x, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 10))
Copy link
Member Author

Choose a reason for hiding this comment

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

When I saw 100+ baselines changed, I thought I had done something horribly wrong, but... this seems like an improvement?


export interface I {
>I : Symbol(I, Decl(DeclarationErrorsNoEmitOnError.ts, 0, 23))
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/accessorBodyInTypeContext.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ type A = {
>A : Symbol(A, Decl(accessorBodyInTypeContext.ts, 0, 0))

get foo() { return 0 }
>foo : Symbol(foo, Decl(accessorBodyInTypeContext.ts, 0, 10))
>foo : Symbol(A.foo, Decl(accessorBodyInTypeContext.ts, 0, 10))

};

type B = {
>B : Symbol(B, Decl(accessorBodyInTypeContext.ts, 2, 2))

set foo(v: any) { }
>foo : Symbol(foo, Decl(accessorBodyInTypeContext.ts, 4, 10))
>foo : Symbol(B.foo, Decl(accessorBodyInTypeContext.ts, 4, 10))
>v : Symbol(v, Decl(accessorBodyInTypeContext.ts, 5, 12))

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export var a = vextend({
>val : Symbol(val, Decl(app.js, 4, 10))

this.data2 = 1;
>this : Symbol(__type, Decl(lib.es5.d.ts, --, --))
>this : Symbol(Record, Decl(lib.es5.d.ts, --, --))
>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6))

},
Expand Down
1 change: 0 additions & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2391,7 +2391,6 @@ declare namespace ts {
UseAliasDefinedOutsideCurrentScope = 16384,
UseSingleQuotesForStringLiteralType = 268435456,
NoTypeReduction = 536870912,
NoUndefinedOptionalParameterType = 1073741824,
AllowThisInObjectLiteral = 32768,
AllowQualifiedNameInPlaceOfIdentifier = 65536,
/** @deprecated AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. */
Expand Down
1 change: 0 additions & 1 deletion tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2391,7 +2391,6 @@ declare namespace ts {
UseAliasDefinedOutsideCurrentScope = 16384,
UseSingleQuotesForStringLiteralType = 268435456,
NoTypeReduction = 536870912,
NoUndefinedOptionalParameterType = 1073741824,
AllowThisInObjectLiteral = 32768,
AllowQualifiedNameInPlaceOfIdentifier = 65536,
/** @deprecated AllowQualifedNameInPlaceOfIdentifier. Use AllowQualifiedNameInPlaceOfIdentifier instead. */
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/argumentsAsPropertyName.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type MyType = {
>MyType : Symbol(MyType, Decl(argumentsAsPropertyName.ts, 0, 0))

arguments: Array<string>
>arguments : Symbol(arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
>arguments : Symbol(MyType.arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}

Expand All @@ -24,9 +24,9 @@ function myFunction(myType: MyType) {

use(myType.arguments[i]);
>use : Symbol(use, Decl(argumentsAsPropertyName.ts, 3, 1))
>myType.arguments : Symbol(arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
>myType.arguments : Symbol(MyType.arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
>myType : Symbol(myType, Decl(argumentsAsPropertyName.ts, 7, 20))
>arguments : Symbol(arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
>arguments : Symbol(MyType.arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
>i : Symbol(i, Decl(argumentsAsPropertyName.ts, 8, 12))

// create closure so that tsc will turn loop body into function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type BadFlatArray<Arr, Depth extends number> = {obj: {
>1 : 1

declare function flat<A, D extends number = 1>(
>flat : <A, D extends number = 1>(arr: A, depth?: D | undefined) => BadFlatArray<A, D>[]
>flat : <A, D extends number = 1>(arr: A, depth?: D) => BadFlatArray<A, D>[]

arr: A,
>arr : A
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/assertionTypePredicates1.types
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ namespace Debug {
>Debug : typeof Debug

export declare function assert(value: unknown, message?: string): asserts value;
>assert : (value: unknown, message?: string | undefined) => asserts value
>assert : (value: unknown, message?: string) => asserts value
>value : unknown
>message : string | undefined

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Example1 {

type S = { done: boolean, value: number };
>S : Symbol(S, Decl(assignmentCompatWithDiscriminatedUnion.ts, 3, 20))
>done : Symbol(done, Decl(assignmentCompatWithDiscriminatedUnion.ts, 4, 14))
>value : Symbol(value, Decl(assignmentCompatWithDiscriminatedUnion.ts, 4, 29))
>done : Symbol(S.done, Decl(assignmentCompatWithDiscriminatedUnion.ts, 4, 14))
>value : Symbol(S.value, Decl(assignmentCompatWithDiscriminatedUnion.ts, 4, 29))

type T =
>T : Symbol(T, Decl(assignmentCompatWithDiscriminatedUnion.ts, 4, 46))
Expand Down Expand Up @@ -42,8 +42,8 @@ namespace Example2 {

type S = { a: 0 | 2, b: 4 };
>S : Symbol(S, Decl(assignmentCompatWithDiscriminatedUnion.ts, 18, 20))
>a : Symbol(a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 19, 14))
>b : Symbol(b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 19, 24))
>a : Symbol(S.a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 19, 14))
>b : Symbol(S.b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 19, 24))

type T = { a: 0, b: 1 | 4 } // T0
>T : Symbol(T, Decl(assignmentCompatWithDiscriminatedUnion.ts, 19, 32))
Expand Down Expand Up @@ -79,8 +79,8 @@ namespace Example3 {

type S = { a: 0 | 2, b: 4 };
>S : Symbol(S, Decl(assignmentCompatWithDiscriminatedUnion.ts, 32, 20))
>a : Symbol(a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 33, 14))
>b : Symbol(b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 33, 24))
>a : Symbol(S.a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 33, 14))
>b : Symbol(S.b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 33, 24))

type T = { a: 0, b: 1 | 4 } // T0
>T : Symbol(T, Decl(assignmentCompatWithDiscriminatedUnion.ts, 33, 32))
Expand Down Expand Up @@ -117,8 +117,8 @@ namespace Example4 {

type S = { a: 0 | 2, b: 4 };
>S : Symbol(S, Decl(assignmentCompatWithDiscriminatedUnion.ts, 47, 20))
>a : Symbol(a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 48, 14))
>b : Symbol(b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 48, 24))
>a : Symbol(S.a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 48, 14))
>b : Symbol(S.b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 48, 24))

type T = { a: 0, b: 1 | 4 } // T0
>T : Symbol(T, Decl(assignmentCompatWithDiscriminatedUnion.ts, 48, 32))
Expand Down Expand Up @@ -161,11 +161,11 @@ namespace Example5 {

type S = { a: N, b: N, c: N };
>S : Symbol(S, Decl(assignmentCompatWithDiscriminatedUnion.ts, 65, 23))
>a : Symbol(a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 66, 14))
>a : Symbol(S.a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 66, 14))
>N : Symbol(N, Decl(assignmentCompatWithDiscriminatedUnion.ts, 61, 20))
>b : Symbol(b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 66, 20))
>b : Symbol(S.b, Decl(assignmentCompatWithDiscriminatedUnion.ts, 66, 20))
>N : Symbol(N, Decl(assignmentCompatWithDiscriminatedUnion.ts, 61, 20))
>c : Symbol(c, Decl(assignmentCompatWithDiscriminatedUnion.ts, 66, 26))
>c : Symbol(S.c, Decl(assignmentCompatWithDiscriminatedUnion.ts, 66, 26))
>N : Symbol(N, Decl(assignmentCompatWithDiscriminatedUnion.ts, 61, 20))

type T = { a: 0, b: N, c: N }
Expand Down Expand Up @@ -273,10 +273,10 @@ namespace GH14865 {
>Style2 : Symbol(Style2, Decl(assignmentCompatWithDiscriminatedUnion.ts, 92, 6))

type: "A" | "B";
>type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 94, 19))
>type : Symbol(Style2.type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 94, 19))

data: string;
>data : Symbol(data, Decl(assignmentCompatWithDiscriminatedUnion.ts, 95, 24))
>data : Symbol(Style2.data, Decl(assignmentCompatWithDiscriminatedUnion.ts, 95, 24))
}

const a: Style2 = { type: "A", data: "whatevs" };
Expand All @@ -290,9 +290,9 @@ namespace GH14865 {
>Style1 : Symbol(Style1, Decl(assignmentCompatWithDiscriminatedUnion.ts, 85, 19))

a.type; // "A" | "B"
>a.type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 94, 19))
>a.type : Symbol(Style2.type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 94, 19))
>a : Symbol(a, Decl(assignmentCompatWithDiscriminatedUnion.ts, 99, 9))
>type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 94, 19))
>type : Symbol(Style2.type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 94, 19))

b.type; // "A" | "B"
>b.type : Symbol(type, Decl(assignmentCompatWithDiscriminatedUnion.ts, 86, 19), Decl(assignmentCompatWithDiscriminatedUnion.ts, 89, 9))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ declare function resolve2<T>(value: T): Windows.Foundation.IPromise<T>;
>Foundation : any

async function sample2(x?: number) {
>sample2 : (x?: number | undefined) => Promise<void>
>sample2 : (x?: number) => Promise<void>
>x : number | undefined

let x1 = await resolve1(x);
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/awaitedType.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type T4 = Awaited<number | Promise<string>>;
type T5 = Awaited<{ then: number }>;
>T5 : Symbol(T5, Decl(awaitedType.ts, 3, 44))
>Awaited : Symbol(Awaited, Decl(lib.es5.d.ts, --, --))
>then : Symbol(then, Decl(awaitedType.ts, 4, 19))
>then : Symbol(T5.then, Decl(awaitedType.ts, 4, 19))

type T6 = Awaited<{ then(): void }>; // never (non-promise "thenable")
>T6 : Symbol(T6, Decl(awaitedType.ts, 4, 36))
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/awaitedTypeStrictNull.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type T4 = Awaited<number | Promise<string>>;
type T5 = Awaited<{ then: number }>;
>T5 : Symbol(T5, Decl(awaitedTypeStrictNull.ts, 3, 44))
>Awaited : Symbol(Awaited, Decl(lib.es5.d.ts, --, --))
>then : Symbol(then, Decl(awaitedTypeStrictNull.ts, 4, 19))
>then : Symbol(T5.then, Decl(awaitedTypeStrictNull.ts, 4, 19))

type T6 = Awaited<{ then(): void }>; // never (non-promise "thenable")
>T6 : Symbol(T6, Decl(awaitedTypeStrictNull.ts, 4, 36))
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/callWithSpread4.symbols
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
=== tests/cases/conformance/expressions/functionCalls/callWithSpread4.ts ===
type R = { a: number }
>R : Symbol(R, Decl(callWithSpread4.ts, 0, 0))
>a : Symbol(a, Decl(callWithSpread4.ts, 0, 10))
>a : Symbol(R.a, Decl(callWithSpread4.ts, 0, 10))

type W = { b: number }
>W : Symbol(W, Decl(callWithSpread4.ts, 0, 22))
>b : Symbol(b, Decl(callWithSpread4.ts, 1, 10))
>b : Symbol(W.b, Decl(callWithSpread4.ts, 1, 10))

type RW = { a: number, b: number }
>RW : Symbol(RW, Decl(callWithSpread4.ts, 1, 22))
>a : Symbol(a, Decl(callWithSpread4.ts, 2, 11))
>b : Symbol(b, Decl(callWithSpread4.ts, 2, 22))
>a : Symbol(RW.a, Decl(callWithSpread4.ts, 2, 11))
>b : Symbol(RW.b, Decl(callWithSpread4.ts, 2, 22))

declare const pli: {
>pli : Symbol(pli, Decl(callWithSpread4.ts, 3, 13))
Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/callsOnComplexSignatures.types
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function test3(items: string[] | number[]) {
}

function test4(
>test4 : (arg1: ((...objs: { x: number;}[]) => number) | ((...objs: { y: number;}[]) => number), arg2: ((a: { x: number;}, b: object) => number) | ((a: object, b: { x: number;}) => number), arg3: ((a: { x: number;}, ...objs: { y: number;}[]) => number) | ((...objs: { x: number;}[]) => number), arg4: ((a?: { x: number; } | undefined, b?: { x: number; } | undefined) => number) | ((a?: { y: number; } | undefined) => number), arg5: ((a?: { x: number; } | undefined, ...b: { x: number;}[]) => number) | ((a?: { y: number; } | undefined) => number), arg6: ((a?: { x: number; } | undefined, b?: { x: number; } | undefined) => number) | ((...a: { y: number;}[]) => number)) => void
>test4 : (arg1: ((...objs: { x: number;}[]) => number) | ((...objs: { y: number;}[]) => number), arg2: ((a: { x: number;}, b: object) => number) | ((a: object, b: { x: number;}) => number), arg3: ((a: { x: number;}, ...objs: { y: number;}[]) => number) | ((...objs: { x: number;}[]) => number), arg4: ((a?: { x: number;}, b?: { x: number;}) => number) | ((a?: { y: number;}) => number), arg5: ((a?: { x: number;}, ...b: { x: number;}[]) => number) | ((a?: { y: number;}) => number), arg6: ((a?: { x: number;}, b?: { x: number;}) => number) | ((...a: { y: number;}[]) => number)) => void

arg1: ((...objs: {x: number}[]) => number) | ((...objs: {y: number}[]) => number),
>arg1 : ((...objs: { x: number;}[]) => number) | ((...objs: { y: number;}[]) => number)
Expand Down Expand Up @@ -138,7 +138,7 @@ function test4(
>x : number

arg4: ((a?: {x: number}, b?: {x: number}) => number) | ((a?: {y: number}) => number),
>arg4 : ((a?: { x: number; } | undefined, b?: { x: number; } | undefined) => number) | ((a?: { y: number; } | undefined) => number)
>arg4 : ((a?: { x: number;}, b?: { x: number;}) => number) | ((a?: { y: number;}) => number)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a little annoying but I guess it’s a general problem with reusing type annotation nodes, not specific to this change 🤔

>a : { x: number; } | undefined
>x : number
>b : { x: number; } | undefined
Expand All @@ -147,7 +147,7 @@ function test4(
>y : number

arg5: ((a?: {x: number}, ...b: {x: number}[]) => number) | ((a?: {y: number}) => number),
>arg5 : ((a?: { x: number; } | undefined, ...b: { x: number;}[]) => number) | ((a?: { y: number; } | undefined) => number)
>arg5 : ((a?: { x: number;}, ...b: { x: number;}[]) => number) | ((a?: { y: number;}) => number)
>a : { x: number; } | undefined
>x : number
>b : { x: number; }[]
Expand All @@ -156,7 +156,7 @@ function test4(
>y : number

arg6: ((a?: {x: number}, b?: {x: number}) => number) | ((...a: {y: number}[]) => number),
>arg6 : ((a?: { x: number; } | undefined, b?: { x: number; } | undefined) => number) | ((...a: { y: number;}[]) => number)
>arg6 : ((a?: { x: number;}, b?: { x: number;}) => number) | ((...a: { y: number;}[]) => number)
>a : { x: number; } | undefined
>x : number
>b : { x: number; } | undefined
Expand Down Expand Up @@ -339,7 +339,7 @@ function test5() {

// Pair of non-like intrinsics
function render(url?: string): React.ReactNode {
>render : (url?: string | undefined) => React.ReactNode
>render : (url?: string) => React.ReactNode
>url : string | undefined
>React : any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type TypeA = {
>TypeA : Symbol(TypeA, Decl(type-a.ts, 0, 0))

a: string;
>a : Symbol(a, Decl(type-a.ts, 0, 21))
>a : Symbol(TypeA.a, Decl(type-a.ts, 0, 21))
}
=== tests/cases/compiler/Uppercased_Dir/src/types.ts ===
export type Merge<T, U> = T & U;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/checkJsdocTypeTag4.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
type A<T extends string> = { a: T }
>A : Symbol(A, Decl(t.d.ts, 0, 0))
>T : Symbol(T, Decl(t.d.ts, 0, 7))
>a : Symbol(a, Decl(t.d.ts, 0, 28))
>a : Symbol(A.a, Decl(t.d.ts, 0, 28))
>T : Symbol(T, Decl(t.d.ts, 0, 7))

=== tests/cases/conformance/jsdoc/test.js ===
Expand Down
Loading