diff --git a/tsc/internal/checker/nodebuilderimpl.go b/tsc/internal/checker/nodebuilderimpl.go index b7322db280638..2fd161713af87 100644 --- a/tsc/internal/checker/nodebuilderimpl.go +++ b/tsc/internal/checker/nodebuilderimpl.go @@ -41,9 +41,10 @@ type SerializedTypeEntry struct { } type CompositeTypeCacheIdentity struct { - typeId TypeId - flags nodebuilder.Flags - internalFlags nodebuilder.InternalFlags + typeId TypeId + flags nodebuilder.Flags + internalFlags nodebuilder.InternalFlags + inferTypeParameters CacheHashKey } type NodeBuilderLinks struct { @@ -3084,7 +3085,7 @@ func (b *NodeBuilderImpl) getParentSymbolOfTypeParameter(typeParameter *TypePara return b.ch.getSymbolOfNode(host) } -func (b *NodeBuilderImpl) typeReferenceToTypeNode(t *Type) *ast.TypeNode { +func (b *NodeBuilderImpl) arrayOrTupleTypeToNode(t *Type) *ast.TypeNode { var typeArguments []*Type = b.ch.getTypeArguments(t) if t.Target() == b.ch.globalArrayType || t.Target() == b.ch.globalReadonlyArrayType { if b.ctx.flags&nodebuilder.FlagsWriteArrayAsGenericType != 0 { @@ -3101,7 +3102,8 @@ func (b *NodeBuilderImpl) typeReferenceToTypeNode(t *Type) *ast.TypeNode { } else { return b.f.NewTypeOperatorNode(ast.KindReadonlyKeyword, arrayType) } - } else if t.Target().objectFlags&ObjectFlagsTuple != 0 { + } else { + debug.Assert(t.Target().objectFlags&ObjectFlagsTuple != 0) typeArguments = core.SameMapIndex(typeArguments, func(arg *Type, i int) *Type { isOptional := false if i < len(t.Target().AsTupleType().elementInfos) { @@ -3154,7 +3156,12 @@ func (b *NodeBuilderImpl) typeReferenceToTypeNode(t *Type) *ast.TypeNode { b.ctx.encounteredError = true return nil // TODO: GH#18217 - } else if b.ctx.flags&nodebuilder.FlagsWriteClassExpressionAsTypeLiteral != 0 && t.symbol.ValueDeclaration != nil && ast.IsClassLike(t.symbol.ValueDeclaration) && !b.ch.IsValueSymbolAccessible(t.symbol, b.ctx.enclosingDeclaration) { + } +} + +func (b *NodeBuilderImpl) typeReferenceToTypeNode(t *Type) *ast.TypeNode { + var typeArguments []*Type = b.ch.getTypeArguments(t) + if b.ctx.flags&nodebuilder.FlagsWriteClassExpressionAsTypeLiteral != 0 && t.symbol.ValueDeclaration != nil && ast.IsClassLike(t.symbol.ValueDeclaration) && !b.ch.IsValueSymbolAccessible(t.symbol, b.ctx.enclosingDeclaration) { return b.createAnonymousTypeNode(t) } else { outerTypeParameters := t.Target().AsInterfaceType().OuterTypeParameters() @@ -3232,9 +3239,21 @@ func (b *NodeBuilderImpl) visitAndTransformType(t *Type, transform func(b *NodeB } typeId := t.id + isArrayOrTuple := b.ch.isArrayOrTupleType(t) + if isArrayOrTuple { + // Deferred and regular references share a cycle identity. + typeId = b.ch.createTypeReference(t.Target(), b.ch.getTypeArguments(t)).id + } + if b.ctx.visitedTypes.Has(typeId) { + return b.createCyclicStructurePlaceholder() + } + isConstructorObject := t.objectFlags&ObjectFlagsAnonymous != 0 && t.symbol != nil && t.symbol.Flags&ast.SymbolFlagsClass != 0 var id *CompositeSymbolIdentity switch { + case isArrayOrTuple: + // Do not bound finite container nesting by the shared Array symbol or tuple origin. + id = nil case t.objectFlags&ObjectFlagsReference != 0 && t.AsTypeReference().node != nil: id = &CompositeSymbolIdentity{false, 0, ast.GetNodeId(t.AsTypeReference().node)} case t.flags&TypeFlagsConditional != 0: @@ -3247,7 +3266,14 @@ func (b *NodeBuilderImpl) visitAndTransformType(t *Type, transform func(b *NodeB // Since instantiations of the same anonymous type have the same symbol, tracking symbols instead // of types allows us to catch circular references to instantiations of the same anonymous type - key := CompositeTypeCacheIdentity{typeId, b.ctx.flags, b.ctx.internalFlags} + key := CompositeTypeCacheIdentity{ + typeId: typeId, + flags: b.ctx.flags, + internalFlags: b.ctx.internalFlags, + } + if len(b.ctx.inferTypeParameters) != 0 { + key.inferTypeParameters = getTypeListKey(b.ctx.inferTypeParameters) + } // Don't rely on type cache if we're expanding a type, because we need to compute `canIncreaseExpansionDepth`. canUseCache := b.ctx.maxExpansionDepth < 0 if canUseCache && b.ctx.enclosingDeclaration != nil && b.links.Has(b.ctx.enclosingDeclaration) { @@ -3518,7 +3544,9 @@ func (b *NodeBuilderImpl) typeToTypeNode(t *Type) *ast.TypeNode { b.ctx.depth-- return result } - if t.AsTypeReference().node != nil { + if b.ch.isArrayOrTupleType(t) { + return b.visitAndTransformType(t, (*NodeBuilderImpl).arrayOrTupleTypeToNode) + } else if t.AsTypeReference().node != nil { return b.visitAndTransformType(t, (*NodeBuilderImpl).typeReferenceToTypeNode) } else { return b.typeReferenceToTypeNode(t) diff --git a/tsc/internal/execute/tsctests/tsc_test.go b/tsc/internal/execute/tsctests/tsc_test.go index c7600ac875577..b6e614917cca3 100644 --- a/tsc/internal/execute/tsctests/tsc_test.go +++ b/tsc/internal/execute/tsctests/tsc_test.go @@ -2432,6 +2432,58 @@ func TestTscIncremental(t *testing.T) { noChange, }, }, + { + subScenario: "recursive tagged tuple after incremental edits", + files: FileMap{ + "/home/src/workspaces/project/tsconfig.json": `{"compilerOptions": {"strict": true, "incremental": true, "noEmit": true, "module": "esnext", "moduleResolution": "bundler"}}`, + tscLibPath + "/lib.es2026.full.d.ts": libWithReadonlyArray, + "/home/src/workspaces/project/doc.ts": stringtestutil.Dedent(` + type Doc = + | string + | { [k: string]: Doc } + | readonly ["array", Doc] + | readonly ["array", Doc, { length: number }] + | readonly ["array", Doc, { min?: number; max?: number }] + | readonly ["union", Doc, ...Doc[]]; + export declare const doc: Doc; + `), + "/home/src/workspaces/project/consumer.ts": stringtestutil.Dedent(` + import { doc } from "./doc"; + export const value = doc; + `), + }, + edits: []*tscEdit{ + noChange, + { + caption: "add a comment to the recursive type", + edit: func(sys *TestSys) { + sys.appendFile("/home/src/workspaces/project/doc.ts", "\n// comment-only edit\n") + }, + }, + noChange, + { + caption: "add a union constituent", + edit: func(sys *TestSys) { + sys.replaceFileText("/home/src/workspaces/project/doc.ts", "| string", "| number\n | string") + }, + }, + noChange, + { + caption: "verify the consumer type was not weakened", + edit: func(sys *TestSys) { + sys.appendFile("/home/src/workspaces/project/consumer.ts", "\nexport const invalid: number = value;\n") + }, + }, + noChange, + { + caption: "delete build info and check the edited source afresh", + edit: func(sys *TestSys) { + sys.removeNoError("/home/src/workspaces/project/tsconfig.tsbuildinfo") + }, + }, + noChange, + }, + }, { subScenario: "json module diagnostics are cleared after fixing the json file", files: FileMap{ diff --git a/tsc/internal/fourslash/tests/quickInfoCanBeTruncated_test.go b/tsc/internal/fourslash/tests/quickInfoCanBeTruncated_test.go index bc434d415d08b..481b598bdf950 100644 --- a/tsc/internal/fourslash/tests/quickInfoCanBeTruncated_test.go +++ b/tsc/internal/fourslash/tests/quickInfoCanBeTruncated_test.go @@ -536,5 +536,5 @@ type DeeplyMapped/*6*/ = {[K in keyof Foo]: {[K2 in keyof Foo]: [K, K2, Foo[K], f.GoToMarker(t, "5") f.VerifyQuickInfoIs(t, "type LongTuple = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17.18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70]", "") f.GoToMarker(t, "6") - f.VerifyQuickInfoIs(t, "type DeeplyMapped = {\n _0: {\n _0: [\"_0\", \"_0\", 0, 0];\n _1: [\"_0\", \"_1\", 0, 1];\n _2: [\"_0\", \"_2\", 0, 2];\n _3: [\"_0\", \"_3\", 0, 3];\n _4: [\"_0\", \"_4\", 0, 4];\n _5: [\"_0\", \"_5\", 0, 5];\n _6: [\"_0\", \"_6\", 0, 6];\n _7: [\"_0\", \"_7\", 0, 7];\n _8: [\"_0\", \"_8\", 0, 8];\n _9: [\"_0\", \"_9\", 0, 9];\n _10: [\"_0\", \"_10\", 0, 10];\n _11: [\"_0\", \"_11\", 0, 11];\n _12: [\"_0\", \"_12\", 0, 12];\n _13: [\"_0\", \"_13\", 0, 13];\n _14: [\"_0\", \"_14\", 0, 14];\n _15: [\"_0\", \"_15\", 0, 15];\n _16: [\"_0\", \"_16\", 0, 16];\n _17: [\"_0\", \"_17\", 0, 17];\n _18: [\"_0\", \"_18\", 0, 18];\n _19: [\"_0\", \"_19\", 0, 19];\n _20: [\"_0\", \"_20\", 0, 20];\n _21: [\"_0\", \"_21\", 0, 21];\n ... 477 more ...;\n _499: [...];\n };\n ... 498 more ...;\n _499: ...;\n}", "") + f.VerifyQuickInfoIs(t, "type DeeplyMapped = {\n _0: {\n _0: [\"_0\", \"_0\", 0, 0];\n _1: [\"_0\", \"_1\", 0, 1];\n _2: [\"_0\", \"_2\", 0, 2];\n _3: [\"_0\", \"_3\", 0, 3];\n _4: [\"_0\", \"_4\", 0, 4];\n _5: [\"_0\", \"_5\", 0, 5];\n _6: [\"_0\", \"_6\", 0, 6];\n _7: [\"_0\", \"_7\", 0, 7];\n _8: [\"_0\", \"_8\", 0, 8];\n _9: [\"_0\", \"_9\", 0, 9];\n _10: [\"_0\", \"_10\", 0, 10];\n _11: [\"_0\", \"_11\", 0, 11];\n _12: [\"_0\", \"_12\", 0, 12];\n _13: [\"_0\", \"_13\", 0, 13];\n _14: [\"_0\", \"_14\", 0, 14];\n _15: [\"_0\", \"_15\", 0, 15];\n _16: [\"_0\", \"_16\", 0, 16];\n _17: [\"_0\", \"_17\", 0, 17];\n _18: [\"_0\", \"_18\", 0, 18];\n _19: [\"_0\", \"_19\", 0, 19];\n _20: [\"_0\", \"_20\", 0, 20];\n _21: [\"_0\", \"_21\", 0, 21];\n ... 477 more ...;\n _499: ...;\n };\n ... 498 more ...;\n _499: ...;\n}", "") } diff --git a/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.errors.txt b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.errors.txt new file mode 100644 index 0000000000000..d46d1d28ca109 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.errors.txt @@ -0,0 +1,48 @@ +local.ts(1,17): error TS5088: The inferred type of 'array' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. +local.ts(5,17): error TS5088: The inferred type of 'tuple' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. +local.ts(9,17): error TS5088: The inferred type of 'readonlyTuple' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. +local.ts(13,17): error TS5088: The inferred type of 'union' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. + + +==== local.ts (4 errors) ==== + export function array() { + ~~~~~ +!!! error TS5088: The inferred type of 'array' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. + type Recursive = Recursive[]; + return null as unknown as Recursive; + } + export function tuple() { + ~~~~~ +!!! error TS5088: The inferred type of 'tuple' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. + type Recursive = [Recursive]; + return null as unknown as Recursive; + } + export function readonlyTuple() { + ~~~~~~~~~~~~~ +!!! error TS5088: The inferred type of 'readonlyTuple' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. + type Recursive = readonly [Recursive]; + return null as unknown as Recursive; + } + export function union() { + ~~~~~ +!!! error TS5088: The inferred type of 'union' references a type with a cyclic structure which cannot be trivially serialized. A type annotation is necessary. + type Recursive = string | Recursive[]; + return null as unknown as Recursive; + } + +==== nameable.ts (0 errors) ==== + export type RecursiveArray = RecursiveArray[]; + export type RecursiveTuple = readonly [RecursiveTuple]; + declare const array: RecursiveArray; + declare const tuple: RecursiveTuple; + export const namedArray = array; + export const namedTuple = tuple; + export function finite() { + type Nested = [[[[[[[[[[[[[number]]]]]]]]]]]]]; + return null as unknown as Nested; + } + export function finiteArray() { + type Nested = number[][][][][][][][][][][][][]; + return null as unknown as Nested; + } + \ No newline at end of file diff --git a/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.js b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.js new file mode 100644 index 0000000000000..41639f70320d7 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.js @@ -0,0 +1,68 @@ +//// [tests/cases/compiler/recursiveContainerDeclarationSerialization.ts] //// + +//// [local.ts] +export function array() { + type Recursive = Recursive[]; + return null as unknown as Recursive; +} +export function tuple() { + type Recursive = [Recursive]; + return null as unknown as Recursive; +} +export function readonlyTuple() { + type Recursive = readonly [Recursive]; + return null as unknown as Recursive; +} +export function union() { + type Recursive = string | Recursive[]; + return null as unknown as Recursive; +} + +//// [nameable.ts] +export type RecursiveArray = RecursiveArray[]; +export type RecursiveTuple = readonly [RecursiveTuple]; +declare const array: RecursiveArray; +declare const tuple: RecursiveTuple; +export const namedArray = array; +export const namedTuple = tuple; +export function finite() { + type Nested = [[[[[[[[[[[[[number]]]]]]]]]]]]]; + return null as unknown as Nested; +} +export function finiteArray() { + type Nested = number[][][][][][][][][][][][][]; + return null as unknown as Nested; +} + + +//// [local.js] +export function array() { + return null; +} +export function tuple() { + return null; +} +export function readonlyTuple() { + return null; +} +export function union() { + return null; +} +//// [nameable.js] +export const namedArray = array; +export const namedTuple = tuple; +export function finite() { + return null; +} +export function finiteArray() { + return null; +} + + +//// [nameable.d.ts] +export type RecursiveArray = RecursiveArray[]; +export type RecursiveTuple = readonly [RecursiveTuple]; +export declare const namedArray: RecursiveArray; +export declare const namedTuple: RecursiveTuple; +export declare function finite(): [[[[[[[[[[[[[number]]]]]]]]]]]]]; +export declare function finiteArray(): number[][][][][][][][][][][][][]; diff --git a/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.symbols b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.symbols new file mode 100644 index 0000000000000..5d20937ee8126 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.symbols @@ -0,0 +1,88 @@ +//// [tests/cases/compiler/recursiveContainerDeclarationSerialization.ts] //// + +=== local.ts === +export function array() { +>array : Symbol(array, Decl(local.ts, 0, 0)) + + type Recursive = Recursive[]; +>Recursive : Symbol(Recursive, Decl(local.ts, 0, 25)) +>Recursive : Symbol(Recursive, Decl(local.ts, 0, 25)) + + return null as unknown as Recursive; +>Recursive : Symbol(Recursive, Decl(local.ts, 0, 25)) +} +export function tuple() { +>tuple : Symbol(tuple, Decl(local.ts, 3, 1)) + + type Recursive = [Recursive]; +>Recursive : Symbol(Recursive, Decl(local.ts, 4, 25)) +>Recursive : Symbol(Recursive, Decl(local.ts, 4, 25)) + + return null as unknown as Recursive; +>Recursive : Symbol(Recursive, Decl(local.ts, 4, 25)) +} +export function readonlyTuple() { +>readonlyTuple : Symbol(readonlyTuple, Decl(local.ts, 7, 1)) + + type Recursive = readonly [Recursive]; +>Recursive : Symbol(Recursive, Decl(local.ts, 8, 33)) +>Recursive : Symbol(Recursive, Decl(local.ts, 8, 33)) + + return null as unknown as Recursive; +>Recursive : Symbol(Recursive, Decl(local.ts, 8, 33)) +} +export function union() { +>union : Symbol(union, Decl(local.ts, 11, 1)) + + type Recursive = string | Recursive[]; +>Recursive : Symbol(Recursive, Decl(local.ts, 12, 25)) +>Recursive : Symbol(Recursive, Decl(local.ts, 12, 25)) + + return null as unknown as Recursive; +>Recursive : Symbol(Recursive, Decl(local.ts, 12, 25)) +} + +=== nameable.ts === +export type RecursiveArray = RecursiveArray[]; +>RecursiveArray : Symbol(RecursiveArray, Decl(nameable.ts, 0, 0)) +>RecursiveArray : Symbol(RecursiveArray, Decl(nameable.ts, 0, 0)) + +export type RecursiveTuple = readonly [RecursiveTuple]; +>RecursiveTuple : Symbol(RecursiveTuple, Decl(nameable.ts, 0, 46)) +>RecursiveTuple : Symbol(RecursiveTuple, Decl(nameable.ts, 0, 46)) + +declare const array: RecursiveArray; +>array : Symbol(array, Decl(nameable.ts, 2, 13)) +>RecursiveArray : Symbol(RecursiveArray, Decl(nameable.ts, 0, 0)) + +declare const tuple: RecursiveTuple; +>tuple : Symbol(tuple, Decl(nameable.ts, 3, 13)) +>RecursiveTuple : Symbol(RecursiveTuple, Decl(nameable.ts, 0, 46)) + +export const namedArray = array; +>namedArray : Symbol(namedArray, Decl(nameable.ts, 4, 12)) +>array : Symbol(array, Decl(nameable.ts, 2, 13)) + +export const namedTuple = tuple; +>namedTuple : Symbol(namedTuple, Decl(nameable.ts, 5, 12)) +>tuple : Symbol(tuple, Decl(nameable.ts, 3, 13)) + +export function finite() { +>finite : Symbol(finite, Decl(nameable.ts, 5, 32)) + + type Nested = [[[[[[[[[[[[[number]]]]]]]]]]]]]; +>Nested : Symbol(Nested, Decl(nameable.ts, 6, 26)) + + return null as unknown as Nested; +>Nested : Symbol(Nested, Decl(nameable.ts, 6, 26)) +} +export function finiteArray() { +>finiteArray : Symbol(finiteArray, Decl(nameable.ts, 9, 1)) + + type Nested = number[][][][][][][][][][][][][]; +>Nested : Symbol(Nested, Decl(nameable.ts, 10, 31)) + + return null as unknown as Nested; +>Nested : Symbol(Nested, Decl(nameable.ts, 10, 31)) +} + diff --git a/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.types b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.types new file mode 100644 index 0000000000000..b5c8d4fa46b67 --- /dev/null +++ b/tsc/testdata/baselines/reference/compiler/recursiveContainerDeclarationSerialization.types @@ -0,0 +1,86 @@ +//// [tests/cases/compiler/recursiveContainerDeclarationSerialization.ts] //// + +=== local.ts === +export function array() { +>array : () => any[] + + type Recursive = Recursive[]; +>Recursive : any[] + + return null as unknown as Recursive; +>null as unknown as Recursive : any[] +>null as unknown : unknown +} +export function tuple() { +>tuple : () => [any] + + type Recursive = [Recursive]; +>Recursive : [any] + + return null as unknown as Recursive; +>null as unknown as Recursive : [any] +>null as unknown : unknown +} +export function readonlyTuple() { +>readonlyTuple : () => readonly [any] + + type Recursive = readonly [Recursive]; +>Recursive : readonly [any] + + return null as unknown as Recursive; +>null as unknown as Recursive : readonly [any] +>null as unknown : unknown +} +export function union() { +>union : () => string | (string | any)[] + + type Recursive = string | Recursive[]; +>Recursive : string | (string | any)[] + + return null as unknown as Recursive; +>null as unknown as Recursive : string | (string | any)[] +>null as unknown : unknown +} + +=== nameable.ts === +export type RecursiveArray = RecursiveArray[]; +>RecursiveArray : RecursiveArray + +export type RecursiveTuple = readonly [RecursiveTuple]; +>RecursiveTuple : RecursiveTuple + +declare const array: RecursiveArray; +>array : RecursiveArray + +declare const tuple: RecursiveTuple; +>tuple : RecursiveTuple + +export const namedArray = array; +>namedArray : RecursiveArray +>array : RecursiveArray + +export const namedTuple = tuple; +>namedTuple : RecursiveTuple +>tuple : RecursiveTuple + +export function finite() { +>finite : () => [[[[[[[[[[[[[number]]]]]]]]]]]]] + + type Nested = [[[[[[[[[[[[[number]]]]]]]]]]]]]; +>Nested : [[[[[[[[[[[[[number]]]]]]]]]]]]] + + return null as unknown as Nested; +>null as unknown as Nested : [[[[[[[[[[[[[number]]]]]]]]]]]]] +>null as unknown : unknown +} +export function finiteArray() { +>finiteArray : () => number[][][][][][][][][][][][][] + + type Nested = number[][][][][][][][][][][][][]; +>Nested : number[][][][][][][][][][][][][] + + return null as unknown as Nested; +>null as unknown as Nested : number[][][][][][][][][][][][][] +>null as unknown : unknown +} + diff --git a/tsc/testdata/baselines/reference/compiler/recursiveTypeInference2.types b/tsc/testdata/baselines/reference/compiler/recursiveTypeInference2.types index 5cba09f8890e8..bbb72418857ba 100644 --- a/tsc/testdata/baselines/reference/compiler/recursiveTypeInference2.types +++ b/tsc/testdata/baselines/reference/compiler/recursiveTypeInference2.types @@ -140,11 +140,11 @@ const Tree = object({ return array(Tree).default([]) >array(Tree).default([]) : ZodDefault>>>; }>>>> ->array(Tree).default : { (def: { name: string; children: any[]; }[]): ZodDefault>>>; }>>>>; (def: () => { name: string; children: any[]; }[]): ZodDefault>>>; }>>>>; } +>array(Tree).default : { (def: { name: string; children: any; }[]): ZodDefault>>>; }>>>>; (def: () => { name: string; children: any; }[]): ZodDefault>>>; }>>>>; } >array(Tree) : ZodArray>>>; }>>> >array : (element: T) => ZodArray >Tree : ZodObject>>>; }>> ->default : { (def: { name: string; children: any[]; }[]): ZodDefault>>>; }>>>>; (def: () => { name: string; children: any[]; }[]): ZodDefault>>>; }>>>>; } +>default : { (def: { name: string; children: any; }[]): ZodDefault>>>; }>>>>; (def: () => { name: string; children: any; }[]): ZodDefault>>>; }>>>>; } >[] : never[] }, diff --git a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.errors.txt b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.errors.txt index aa2ae24033b16..4cff79787477b 100644 --- a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.errors.txt +++ b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.errors.txt @@ -72,8 +72,8 @@ conditionalTypes1.ts(159,5): error TS2322: Type 'ZeroOf' is not assignable to conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. Type 'string | number' is not assignable to type 'ZeroOf'. Type 'string' is not assignable to type 'ZeroOf'. -conditionalTypes1.ts(263,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo'. -conditionalTypes1.ts(288,43): error TS2322: Type 'T95' is not assignable to type 'T94'. +conditionalTypes1.ts(279,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo'. +conditionalTypes1.ts(304,43): error TS2322: Type 'T95' is not assignable to type 'T94'. Type 'number | boolean' is not assignable to type 'T94'. Type 'number' is not assignable to type 'T94'. Type 'boolean' is not assignable to type 'true'. @@ -396,6 +396,22 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95' is not assignable to t let e = x[0]; // string } + function inferTuple(x: T extends [infer U, infer V] ? [U, V] : never) { + return x; + } + + function inferObject(x: T extends { value: infer U } ? { value: U } : never) { + return x; + } + + function inferFunction(x: T extends () => infer U ? () => U : never) { + return x; + } + + function inferNested(x: T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never) { + return x; + } + // Repros from #21664 type Eq = T extends U ? U extends T ? true : false : false; @@ -439,7 +455,7 @@ conditionalTypes1.ts(288,43): error TS2322: Type 'T95' is not assignable to t var z: T2; // Error, T2 is distributive, T1 isn't ~ !!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo'. -!!! related TS6203 conditionalTypes1.ts:262:9: 'z' was also declared here. +!!! related TS6203 conditionalTypes1.ts:278:9: 'z' was also declared here. } function f33() { diff --git a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.js b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.js index 0e09cc139f003..95cd9db4ad0a9 100644 --- a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.js +++ b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.js @@ -223,6 +223,22 @@ function f23(x: T extends (infer U)[] ? U[] : never) { let e = x[0]; // string } +function inferTuple(x: T extends [infer U, infer V] ? [U, V] : never) { + return x; +} + +function inferObject(x: T extends { value: infer U } ? { value: U } : never) { + return x; +} + +function inferFunction(x: T extends () => infer U ? () => U : never) { + return x; +} + +function inferNested(x: T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never) { + return x; +} + // Repros from #21664 type Eq = T extends U ? U extends T ? true : false : false; @@ -434,6 +450,18 @@ function f22(x) { function f23(x) { let e = x[0]; // string } +function inferTuple(x) { + return x; +} +function inferObject(x) { + return x; +} +function inferFunction(x) { + return x; +} +function inferNested(x) { + return x; +} const convert = (value) => value; const convert2 = (value) => value; function f31() { @@ -630,6 +658,18 @@ type T51 = IsNever; type T52 = IsNever; declare function f22(x: T extends (infer U)[] ? U[] : never): void; declare function f23(x: T extends (infer U)[] ? U[] : never): void; +declare function inferTuple(x: T extends [infer U, infer V] ? [U, V] : never): T extends [infer U, infer V] ? [U, V] : never; +declare function inferObject(x: T extends { + value: infer U; +} ? { + value: U; +} : never): T extends { + value: infer U; +} ? { + value: U; +} : never; +declare function inferFunction(x: T extends () => infer U ? () => U : never): T extends () => infer U ? () => U : never; +declare function inferNested(x: T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never): T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never; type Eq = T extends U ? U extends T ? true : false : false; type T60 = Eq; type T61 = Eq; diff --git a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.symbols b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.symbols index a7e3ebed3920c..0cdffaab573a6 100644 --- a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.symbols +++ b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.symbols @@ -847,556 +847,612 @@ function f23(x: T extends (infer U)[] ? U[] : never) { >x : Symbol(x, Decl(conditionalTypes1.ts, 218, 33)) } +function inferTuple(x: T extends [infer U, infer V] ? [U, V] : never) { +>inferTuple : Symbol(inferTuple, Decl(conditionalTypes1.ts, 220, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 222, 20)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 222, 23)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 222, 20)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 222, 42)) +>V : Symbol(V, Decl(conditionalTypes1.ts, 222, 51)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 222, 42)) +>V : Symbol(V, Decl(conditionalTypes1.ts, 222, 51)) + + return x; +>x : Symbol(x, Decl(conditionalTypes1.ts, 222, 23)) +} + +function inferObject(x: T extends { value: infer U } ? { value: U } : never) { +>inferObject : Symbol(inferObject, Decl(conditionalTypes1.ts, 224, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 226, 21)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 226, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 226, 21)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 226, 38)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 226, 51)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 226, 59)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 226, 51)) + + return x; +>x : Symbol(x, Decl(conditionalTypes1.ts, 226, 24)) +} + +function inferFunction(x: T extends () => infer U ? () => U : never) { +>inferFunction : Symbol(inferFunction, Decl(conditionalTypes1.ts, 228, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 230, 23)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 230, 26)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 230, 23)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 230, 50)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 230, 50)) + + return x; +>x : Symbol(x, Decl(conditionalTypes1.ts, 230, 26)) +} + +function inferNested(x: T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never) { +>inferNested : Symbol(inferNested, Decl(conditionalTypes1.ts, 232, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 234, 21)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 234, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 234, 21)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 234, 43)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 234, 43)) +>V : Symbol(V, Decl(conditionalTypes1.ts, 234, 67)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 234, 43)) +>V : Symbol(V, Decl(conditionalTypes1.ts, 234, 67)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 234, 43)) + + return x; +>x : Symbol(x, Decl(conditionalTypes1.ts, 234, 24)) +} + // Repros from #21664 type Eq = T extends U ? U extends T ? true : false : false; ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 220, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 224, 8)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 224, 10)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 224, 8)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 224, 10)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 224, 10)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 224, 8)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 236, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 240, 8)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 240, 10)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 240, 8)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 240, 10)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 240, 10)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 240, 8)) type T60 = Eq; // true ->T60 : Symbol(T60, Decl(conditionalTypes1.ts, 224, 65)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 220, 1)) +>T60 : Symbol(T60, Decl(conditionalTypes1.ts, 240, 65)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 236, 1)) type T61 = Eq; // false ->T61 : Symbol(T61, Decl(conditionalTypes1.ts, 225, 26)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 220, 1)) +>T61 : Symbol(T61, Decl(conditionalTypes1.ts, 241, 26)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 236, 1)) type T62 = Eq; // false ->T62 : Symbol(T62, Decl(conditionalTypes1.ts, 226, 27)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 220, 1)) +>T62 : Symbol(T62, Decl(conditionalTypes1.ts, 242, 27)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 236, 1)) type T63 = Eq; // true ->T63 : Symbol(T63, Decl(conditionalTypes1.ts, 227, 27)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 220, 1)) +>T63 : Symbol(T63, Decl(conditionalTypes1.ts, 243, 27)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 236, 1)) type Eq1 = Eq extends false ? false : true; ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 228, 28)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 230, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 230, 11)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 220, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 230, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 230, 11)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 244, 28)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 246, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 246, 11)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 236, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 246, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 246, 11)) type T70 = Eq1; // true ->T70 : Symbol(T70, Decl(conditionalTypes1.ts, 230, 55)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 228, 28)) +>T70 : Symbol(T70, Decl(conditionalTypes1.ts, 246, 55)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 244, 28)) type T71 = Eq1; // false ->T71 : Symbol(T71, Decl(conditionalTypes1.ts, 231, 27)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 228, 28)) +>T71 : Symbol(T71, Decl(conditionalTypes1.ts, 247, 27)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 244, 28)) type T72 = Eq1; // false ->T72 : Symbol(T72, Decl(conditionalTypes1.ts, 232, 28)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 228, 28)) +>T72 : Symbol(T72, Decl(conditionalTypes1.ts, 248, 28)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 244, 28)) type T73 = Eq1; // true ->T73 : Symbol(T73, Decl(conditionalTypes1.ts, 233, 28)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 228, 28)) +>T73 : Symbol(T73, Decl(conditionalTypes1.ts, 249, 28)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 244, 28)) type Eq2 = Eq extends true ? true : false; ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 234, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 236, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 236, 11)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 220, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 236, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 236, 11)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 250, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 252, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 252, 11)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 236, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 252, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 252, 11)) type T80 = Eq2; // true ->T80 : Symbol(T80, Decl(conditionalTypes1.ts, 236, 54)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 234, 29)) +>T80 : Symbol(T80, Decl(conditionalTypes1.ts, 252, 54)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 250, 29)) type T81 = Eq2; // false ->T81 : Symbol(T81, Decl(conditionalTypes1.ts, 237, 27)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 234, 29)) +>T81 : Symbol(T81, Decl(conditionalTypes1.ts, 253, 27)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 250, 29)) type T82 = Eq2; // false ->T82 : Symbol(T82, Decl(conditionalTypes1.ts, 238, 28)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 234, 29)) +>T82 : Symbol(T82, Decl(conditionalTypes1.ts, 254, 28)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 250, 29)) type T83 = Eq2; // true ->T83 : Symbol(T83, Decl(conditionalTypes1.ts, 239, 28)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 234, 29)) +>T83 : Symbol(T83, Decl(conditionalTypes1.ts, 255, 28)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 250, 29)) // Repro from #21756 type Foo = T extends string ? boolean : number; ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 240, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 244, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 244, 9)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 256, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 260, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 260, 9)) type Bar = T extends string ? boolean : number; ->Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 244, 50)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 245, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 245, 9)) +>Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 260, 50)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 261, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 261, 9)) const convert = (value: Foo): Bar => value; ->convert : Symbol(convert, Decl(conditionalTypes1.ts, 246, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 246, 17)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 246, 20)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 240, 29)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 246, 17)) ->Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 244, 50)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 246, 17)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 246, 20)) +>convert : Symbol(convert, Decl(conditionalTypes1.ts, 262, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 262, 17)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 262, 20)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 256, 29)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 262, 17)) +>Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 260, 50)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 262, 17)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 262, 20)) type Baz = Foo; ->Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 246, 52)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 248, 9)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 240, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 248, 9)) +>Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 262, 52)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 264, 9)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 256, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 264, 9)) const convert2 = (value: Foo): Baz => value; ->convert2 : Symbol(convert2, Decl(conditionalTypes1.ts, 249, 5)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 249, 18)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 249, 21)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 240, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 249, 18)) ->Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 246, 52)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 249, 18)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 249, 21)) +>convert2 : Symbol(convert2, Decl(conditionalTypes1.ts, 265, 5)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 265, 18)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 265, 21)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 256, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 265, 18)) +>Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 262, 52)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 265, 18)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 265, 21)) function f31() { ->f31 : Symbol(f31, Decl(conditionalTypes1.ts, 249, 53)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 251, 13)) +>f31 : Symbol(f31, Decl(conditionalTypes1.ts, 265, 53)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 267, 13)) type T1 = T extends string ? boolean : number; ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 251, 19)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 251, 13)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 267, 19)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 267, 13)) type T2 = T extends string ? boolean : number; ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 252, 50)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 251, 13)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 268, 50)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 267, 13)) var x: T1; ->x : Symbol(x, Decl(conditionalTypes1.ts, 254, 7), Decl(conditionalTypes1.ts, 255, 7)) ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 251, 19)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 270, 7), Decl(conditionalTypes1.ts, 271, 7)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 267, 19)) var x: T2; ->x : Symbol(x, Decl(conditionalTypes1.ts, 254, 7), Decl(conditionalTypes1.ts, 255, 7)) ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 252, 50)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 270, 7), Decl(conditionalTypes1.ts, 271, 7)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 268, 50)) } function f32() { ->f32 : Symbol(f32, Decl(conditionalTypes1.ts, 256, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 258, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 258, 15)) +>f32 : Symbol(f32, Decl(conditionalTypes1.ts, 272, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 274, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 274, 15)) type T1 = T & U extends string ? boolean : number; ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 258, 22)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 258, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 258, 15)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 274, 22)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 274, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 274, 15)) type T2 = Foo; ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 259, 54)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 240, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 258, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 258, 15)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 275, 54)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 256, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 274, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 274, 15)) var z: T1; ->z : Symbol(z, Decl(conditionalTypes1.ts, 261, 7), Decl(conditionalTypes1.ts, 262, 7)) ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 258, 22)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 277, 7), Decl(conditionalTypes1.ts, 278, 7)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 274, 22)) var z: T2; // Error, T2 is distributive, T1 isn't ->z : Symbol(z, Decl(conditionalTypes1.ts, 261, 7), Decl(conditionalTypes1.ts, 262, 7)) ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 259, 54)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 277, 7), Decl(conditionalTypes1.ts, 278, 7)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 275, 54)) } function f33() { ->f33 : Symbol(f33, Decl(conditionalTypes1.ts, 263, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 265, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 265, 15)) +>f33 : Symbol(f33, Decl(conditionalTypes1.ts, 279, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 281, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 281, 15)) type T1 = Foo; ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 265, 22)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 240, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 265, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 265, 15)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 281, 22)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 256, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 281, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 281, 15)) type T2 = Bar; ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 266, 25)) ->Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 244, 50)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 265, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 265, 15)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 282, 25)) +>Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 260, 50)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 281, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 281, 15)) var z: T1; ->z : Symbol(z, Decl(conditionalTypes1.ts, 268, 7), Decl(conditionalTypes1.ts, 269, 7)) ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 265, 22)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 284, 7), Decl(conditionalTypes1.ts, 285, 7)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 281, 22)) var z: T2; ->z : Symbol(z, Decl(conditionalTypes1.ts, 268, 7), Decl(conditionalTypes1.ts, 269, 7)) ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 266, 25)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 284, 7), Decl(conditionalTypes1.ts, 285, 7)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 282, 25)) } // Repro from #21823 type T90 = T extends 0 ? 0 : () => 0; ->T90 : Symbol(T90, Decl(conditionalTypes1.ts, 270, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 274, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 274, 9)) +>T90 : Symbol(T90, Decl(conditionalTypes1.ts, 286, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 290, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 290, 9)) type T91 = T extends 0 ? 0 : () => 0; ->T91 : Symbol(T91, Decl(conditionalTypes1.ts, 274, 40)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 275, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 275, 9)) +>T91 : Symbol(T91, Decl(conditionalTypes1.ts, 290, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 291, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 291, 9)) const f40 = (a: T90): T91 => a; ->f40 : Symbol(f40, Decl(conditionalTypes1.ts, 276, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 276, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 276, 16)) ->T90 : Symbol(T90, Decl(conditionalTypes1.ts, 270, 1)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 276, 13)) ->T91 : Symbol(T91, Decl(conditionalTypes1.ts, 274, 40)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 276, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 276, 16)) +>f40 : Symbol(f40, Decl(conditionalTypes1.ts, 292, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 292, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 292, 16)) +>T90 : Symbol(T90, Decl(conditionalTypes1.ts, 286, 1)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 292, 13)) +>T91 : Symbol(T91, Decl(conditionalTypes1.ts, 290, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 292, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 292, 16)) const f41 = (a: T91): T90 => a; ->f41 : Symbol(f41, Decl(conditionalTypes1.ts, 277, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 277, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 277, 16)) ->T91 : Symbol(T91, Decl(conditionalTypes1.ts, 274, 40)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 277, 13)) ->T90 : Symbol(T90, Decl(conditionalTypes1.ts, 270, 1)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 277, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 277, 16)) +>f41 : Symbol(f41, Decl(conditionalTypes1.ts, 293, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 293, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 293, 16)) +>T91 : Symbol(T91, Decl(conditionalTypes1.ts, 290, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 293, 13)) +>T90 : Symbol(T90, Decl(conditionalTypes1.ts, 286, 1)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 293, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 293, 16)) type T92 = T extends () => 0 ? () => 1 : () => 2; ->T92 : Symbol(T92, Decl(conditionalTypes1.ts, 277, 40)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 279, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 279, 9)) +>T92 : Symbol(T92, Decl(conditionalTypes1.ts, 293, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 295, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 295, 9)) type T93 = T extends () => 0 ? () => 1 : () => 2; ->T93 : Symbol(T93, Decl(conditionalTypes1.ts, 279, 52)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 280, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 280, 9)) +>T93 : Symbol(T93, Decl(conditionalTypes1.ts, 295, 52)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 296, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 296, 9)) const f42 = (a: T92): T93 => a; ->f42 : Symbol(f42, Decl(conditionalTypes1.ts, 281, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 281, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 281, 16)) ->T92 : Symbol(T92, Decl(conditionalTypes1.ts, 277, 40)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 281, 13)) ->T93 : Symbol(T93, Decl(conditionalTypes1.ts, 279, 52)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 281, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 281, 16)) +>f42 : Symbol(f42, Decl(conditionalTypes1.ts, 297, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 297, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 297, 16)) +>T92 : Symbol(T92, Decl(conditionalTypes1.ts, 293, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 297, 13)) +>T93 : Symbol(T93, Decl(conditionalTypes1.ts, 295, 52)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 297, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 297, 16)) const f43 = (a: T93): T92 => a; ->f43 : Symbol(f43, Decl(conditionalTypes1.ts, 282, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 282, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 282, 16)) ->T93 : Symbol(T93, Decl(conditionalTypes1.ts, 279, 52)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 282, 13)) ->T92 : Symbol(T92, Decl(conditionalTypes1.ts, 277, 40)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 282, 13)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 282, 16)) +>f43 : Symbol(f43, Decl(conditionalTypes1.ts, 298, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 298, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 298, 16)) +>T93 : Symbol(T93, Decl(conditionalTypes1.ts, 295, 52)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 298, 13)) +>T92 : Symbol(T92, Decl(conditionalTypes1.ts, 293, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 298, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 298, 16)) type T94 = T extends string ? true : 42; ->T94 : Symbol(T94, Decl(conditionalTypes1.ts, 282, 40)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 284, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 284, 9)) +>T94 : Symbol(T94, Decl(conditionalTypes1.ts, 298, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 300, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 300, 9)) type T95 = T extends string ? boolean : number; ->T95 : Symbol(T95, Decl(conditionalTypes1.ts, 284, 43)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 285, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 285, 9)) +>T95 : Symbol(T95, Decl(conditionalTypes1.ts, 300, 43)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 301, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 301, 9)) const f44 = (value: T94): T95 => value; ->f44 : Symbol(f44, Decl(conditionalTypes1.ts, 286, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 286, 13)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 286, 16)) ->T94 : Symbol(T94, Decl(conditionalTypes1.ts, 282, 40)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 286, 13)) ->T95 : Symbol(T95, Decl(conditionalTypes1.ts, 284, 43)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 286, 13)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 286, 16)) +>f44 : Symbol(f44, Decl(conditionalTypes1.ts, 302, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 302, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 302, 16)) +>T94 : Symbol(T94, Decl(conditionalTypes1.ts, 298, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 302, 13)) +>T95 : Symbol(T95, Decl(conditionalTypes1.ts, 300, 43)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 302, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 302, 16)) const f45 = (value: T95): T94 => value; // Error ->f45 : Symbol(f45, Decl(conditionalTypes1.ts, 287, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 287, 13)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 287, 16)) ->T95 : Symbol(T95, Decl(conditionalTypes1.ts, 284, 43)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 287, 13)) ->T94 : Symbol(T94, Decl(conditionalTypes1.ts, 282, 40)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 287, 13)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 287, 16)) +>f45 : Symbol(f45, Decl(conditionalTypes1.ts, 303, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 303, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 303, 16)) +>T95 : Symbol(T95, Decl(conditionalTypes1.ts, 300, 43)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 303, 13)) +>T94 : Symbol(T94, Decl(conditionalTypes1.ts, 298, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 303, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 303, 16)) // Repro from #21863 function f50() { ->f50 : Symbol(f50, Decl(conditionalTypes1.ts, 287, 48)) +>f50 : Symbol(f50, Decl(conditionalTypes1.ts, 303, 48)) type Eq = T extends U ? U extends T ? true : false : false; ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 291, 16)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 292, 12)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 292, 14)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 292, 12)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 292, 14)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 292, 14)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 292, 12)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 307, 16)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 308, 12)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 308, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 308, 12)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 308, 14)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 308, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 308, 12)) type If = S extends false ? U : T; ->If : Symbol(If, Decl(conditionalTypes1.ts, 292, 69)) ->S : Symbol(S, Decl(conditionalTypes1.ts, 293, 12)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 293, 14)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 293, 17)) ->S : Symbol(S, Decl(conditionalTypes1.ts, 293, 12)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 293, 17)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 293, 14)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 308, 69)) +>S : Symbol(S, Decl(conditionalTypes1.ts, 309, 12)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 309, 14)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 309, 17)) +>S : Symbol(S, Decl(conditionalTypes1.ts, 309, 12)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 309, 17)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 309, 14)) type Omit = { [P in keyof T]: If, never, P>; }[keyof T]; ->Omit : Symbol(Omit, Decl(conditionalTypes1.ts, 293, 47)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 294, 14)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 294, 37)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 294, 14)) ->If : Symbol(If, Decl(conditionalTypes1.ts, 292, 69)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 291, 16)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 294, 14)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 294, 37)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 294, 37)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 294, 14)) +>Omit : Symbol(Omit, Decl(conditionalTypes1.ts, 309, 47)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 310, 14)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 310, 37)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 310, 14)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 308, 69)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 307, 16)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 310, 14)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 310, 37)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 310, 37)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 310, 14)) type Omit2 = { [P in keyof T]: If, never, P>; }[keyof T]; ->Omit2 : Symbol(Omit2, Decl(conditionalTypes1.ts, 294, 94)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 295, 15)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 295, 32)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 295, 49)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 295, 15)) ->If : Symbol(If, Decl(conditionalTypes1.ts, 292, 69)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 291, 16)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 295, 15)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 295, 49)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 295, 32)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 295, 49)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 295, 15)) +>Omit2 : Symbol(Omit2, Decl(conditionalTypes1.ts, 310, 94)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 311, 15)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 311, 32)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 311, 49)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 311, 15)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 308, 69)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 307, 16)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 311, 15)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 311, 49)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 311, 32)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 311, 49)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 311, 15)) type A = Omit<{ a: void; b: never; }>; // 'a' ->A : Symbol(A, Decl(conditionalTypes1.ts, 295, 102)) ->Omit : Symbol(Omit, Decl(conditionalTypes1.ts, 293, 47)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 296, 19)) ->b : Symbol(b, Decl(conditionalTypes1.ts, 296, 28)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 311, 102)) +>Omit : Symbol(Omit, Decl(conditionalTypes1.ts, 309, 47)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 312, 19)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 312, 28)) type B = Omit2<{ a: void; b: never; }>; // 'a' ->B : Symbol(B, Decl(conditionalTypes1.ts, 296, 42)) ->Omit2 : Symbol(Omit2, Decl(conditionalTypes1.ts, 294, 94)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 297, 20)) ->b : Symbol(b, Decl(conditionalTypes1.ts, 297, 29)) +>B : Symbol(B, Decl(conditionalTypes1.ts, 312, 42)) +>Omit2 : Symbol(Omit2, Decl(conditionalTypes1.ts, 310, 94)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 313, 20)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 313, 29)) } // Repro from #21862 type OldDiff = ( ->OldDiff : Symbol(OldDiff, Decl(conditionalTypes1.ts, 298, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 302, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 302, 33)) +>OldDiff : Symbol(OldDiff, Decl(conditionalTypes1.ts, 314, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 318, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 318, 33)) & { [P in T]: P; } ->P : Symbol(P, Decl(conditionalTypes1.ts, 303, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 302, 13)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 303, 9)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 319, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 318, 13)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 319, 9)) & { [P in U]: never; } ->P : Symbol(P, Decl(conditionalTypes1.ts, 304, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 302, 33)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 320, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 318, 33)) & { [x: string]: never; } ->x : Symbol(x, Decl(conditionalTypes1.ts, 305, 9)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 321, 9)) )[T]; ->T : Symbol(T, Decl(conditionalTypes1.ts, 302, 13)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 318, 13)) type NewDiff = T extends U ? never : T; ->NewDiff : Symbol(NewDiff, Decl(conditionalTypes1.ts, 306, 5)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 307, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 307, 15)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 307, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 307, 15)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 307, 13)) +>NewDiff : Symbol(NewDiff, Decl(conditionalTypes1.ts, 322, 5)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 323, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 323, 15)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 323, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 323, 15)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 323, 13)) interface A { ->A : Symbol(A, Decl(conditionalTypes1.ts, 307, 45)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 323, 45)) a: 'a'; ->a : Symbol(A.a, Decl(conditionalTypes1.ts, 308, 13)) +>a : Symbol(A.a, Decl(conditionalTypes1.ts, 324, 13)) } interface B1 extends A { ->B1 : Symbol(B1, Decl(conditionalTypes1.ts, 310, 1)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 307, 45)) +>B1 : Symbol(B1, Decl(conditionalTypes1.ts, 326, 1)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 323, 45)) b: 'b'; ->b : Symbol(B1.b, Decl(conditionalTypes1.ts, 311, 24)) +>b : Symbol(B1.b, Decl(conditionalTypes1.ts, 327, 24)) c: OldDiff; ->c : Symbol(B1.c, Decl(conditionalTypes1.ts, 312, 11)) ->OldDiff : Symbol(OldDiff, Decl(conditionalTypes1.ts, 298, 1)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 307, 45)) +>c : Symbol(B1.c, Decl(conditionalTypes1.ts, 328, 11)) +>OldDiff : Symbol(OldDiff, Decl(conditionalTypes1.ts, 314, 1)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 323, 45)) } interface B2 extends A { ->B2 : Symbol(B2, Decl(conditionalTypes1.ts, 314, 1)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 307, 45)) +>B2 : Symbol(B2, Decl(conditionalTypes1.ts, 330, 1)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 323, 45)) b: 'b'; ->b : Symbol(B2.b, Decl(conditionalTypes1.ts, 315, 24)) +>b : Symbol(B2.b, Decl(conditionalTypes1.ts, 331, 24)) c: NewDiff; ->c : Symbol(B2.c, Decl(conditionalTypes1.ts, 316, 11)) ->NewDiff : Symbol(NewDiff, Decl(conditionalTypes1.ts, 306, 5)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 307, 45)) +>c : Symbol(B2.c, Decl(conditionalTypes1.ts, 332, 11)) +>NewDiff : Symbol(NewDiff, Decl(conditionalTypes1.ts, 322, 5)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 323, 45)) } type c1 = B1['c']; // 'c' | 'b' ->c1 : Symbol(c1, Decl(conditionalTypes1.ts, 318, 1)) ->B1 : Symbol(B1, Decl(conditionalTypes1.ts, 310, 1)) +>c1 : Symbol(c1, Decl(conditionalTypes1.ts, 334, 1)) +>B1 : Symbol(B1, Decl(conditionalTypes1.ts, 326, 1)) type c2 = B2['c']; // 'c' | 'b' ->c2 : Symbol(c2, Decl(conditionalTypes1.ts, 319, 18)) ->B2 : Symbol(B2, Decl(conditionalTypes1.ts, 314, 1)) +>c2 : Symbol(c2, Decl(conditionalTypes1.ts, 335, 18)) +>B2 : Symbol(B2, Decl(conditionalTypes1.ts, 330, 1)) // Repro from #21929 type NonFooKeys1 = OldDiff; ->NonFooKeys1 : Symbol(NonFooKeys1, Decl(conditionalTypes1.ts, 320, 18)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 324, 17)) ->OldDiff : Symbol(OldDiff, Decl(conditionalTypes1.ts, 298, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 324, 17)) +>NonFooKeys1 : Symbol(NonFooKeys1, Decl(conditionalTypes1.ts, 336, 18)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 340, 17)) +>OldDiff : Symbol(OldDiff, Decl(conditionalTypes1.ts, 314, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 340, 17)) type NonFooKeys2 = Exclude; ->NonFooKeys2 : Symbol(NonFooKeys2, Decl(conditionalTypes1.ts, 324, 61)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 325, 17)) +>NonFooKeys2 : Symbol(NonFooKeys2, Decl(conditionalTypes1.ts, 340, 61)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 341, 17)) >Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 325, 17)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 341, 17)) type Test1 = NonFooKeys1<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz" ->Test1 : Symbol(Test1, Decl(conditionalTypes1.ts, 325, 61)) ->NonFooKeys1 : Symbol(NonFooKeys1, Decl(conditionalTypes1.ts, 320, 18)) ->foo : Symbol(foo, Decl(conditionalTypes1.ts, 327, 26)) ->bar : Symbol(bar, Decl(conditionalTypes1.ts, 327, 33)) ->baz : Symbol(baz, Decl(conditionalTypes1.ts, 327, 41)) +>Test1 : Symbol(Test1, Decl(conditionalTypes1.ts, 341, 61)) +>NonFooKeys1 : Symbol(NonFooKeys1, Decl(conditionalTypes1.ts, 336, 18)) +>foo : Symbol(foo, Decl(conditionalTypes1.ts, 343, 26)) +>bar : Symbol(bar, Decl(conditionalTypes1.ts, 343, 33)) +>baz : Symbol(baz, Decl(conditionalTypes1.ts, 343, 41)) type Test2 = NonFooKeys2<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz" ->Test2 : Symbol(Test2, Decl(conditionalTypes1.ts, 327, 51)) ->NonFooKeys2 : Symbol(NonFooKeys2, Decl(conditionalTypes1.ts, 324, 61)) ->foo : Symbol(foo, Decl(conditionalTypes1.ts, 328, 26)) ->bar : Symbol(bar, Decl(conditionalTypes1.ts, 328, 33)) ->baz : Symbol(baz, Decl(conditionalTypes1.ts, 328, 41)) +>Test2 : Symbol(Test2, Decl(conditionalTypes1.ts, 343, 51)) +>NonFooKeys2 : Symbol(NonFooKeys2, Decl(conditionalTypes1.ts, 340, 61)) +>foo : Symbol(foo, Decl(conditionalTypes1.ts, 344, 26)) +>bar : Symbol(bar, Decl(conditionalTypes1.ts, 344, 33)) +>baz : Symbol(baz, Decl(conditionalTypes1.ts, 344, 41)) // Repro from #21729 interface Foo2 { foo: string; } ->Foo2 : Symbol(Foo2, Decl(conditionalTypes1.ts, 328, 51)) ->foo : Symbol(Foo2.foo, Decl(conditionalTypes1.ts, 332, 16)) +>Foo2 : Symbol(Foo2, Decl(conditionalTypes1.ts, 344, 51)) +>foo : Symbol(Foo2.foo, Decl(conditionalTypes1.ts, 348, 16)) interface Bar2 { bar: string; } ->Bar2 : Symbol(Bar2, Decl(conditionalTypes1.ts, 332, 31)) ->bar : Symbol(Bar2.bar, Decl(conditionalTypes1.ts, 333, 16)) +>Bar2 : Symbol(Bar2, Decl(conditionalTypes1.ts, 348, 31)) +>bar : Symbol(Bar2.bar, Decl(conditionalTypes1.ts, 349, 16)) type FooBar = Foo2 | Bar2; ->FooBar : Symbol(FooBar, Decl(conditionalTypes1.ts, 333, 31)) ->Foo2 : Symbol(Foo2, Decl(conditionalTypes1.ts, 328, 51)) ->Bar2 : Symbol(Bar2, Decl(conditionalTypes1.ts, 332, 31)) +>FooBar : Symbol(FooBar, Decl(conditionalTypes1.ts, 349, 31)) +>Foo2 : Symbol(Foo2, Decl(conditionalTypes1.ts, 344, 51)) +>Bar2 : Symbol(Bar2, Decl(conditionalTypes1.ts, 348, 31)) declare interface ExtractFooBar { } ->ExtractFooBar : Symbol(ExtractFooBar, Decl(conditionalTypes1.ts, 334, 26)) ->FB : Symbol(FB, Decl(conditionalTypes1.ts, 335, 32)) ->FooBar : Symbol(FooBar, Decl(conditionalTypes1.ts, 333, 31)) +>ExtractFooBar : Symbol(ExtractFooBar, Decl(conditionalTypes1.ts, 350, 26)) +>FB : Symbol(FB, Decl(conditionalTypes1.ts, 351, 32)) +>FooBar : Symbol(FooBar, Decl(conditionalTypes1.ts, 349, 31)) type Extracted = { ->Extracted : Symbol(Extracted, Decl(conditionalTypes1.ts, 335, 54)) ->Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 337, 15)) +>Extracted : Symbol(Extracted, Decl(conditionalTypes1.ts, 351, 54)) +>Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 353, 15)) [K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar : Struct[K]; ->K : Symbol(K, Decl(conditionalTypes1.ts, 338, 5)) ->Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 337, 15)) ->Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 337, 15)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 338, 5)) ->FooBar : Symbol(FooBar, Decl(conditionalTypes1.ts, 333, 31)) ->ExtractFooBar : Symbol(ExtractFooBar, Decl(conditionalTypes1.ts, 334, 26)) ->Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 337, 15)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 338, 5)) ->Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 337, 15)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 338, 5)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 354, 5)) +>Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 353, 15)) +>Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 353, 15)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 354, 5)) +>FooBar : Symbol(FooBar, Decl(conditionalTypes1.ts, 349, 31)) +>ExtractFooBar : Symbol(ExtractFooBar, Decl(conditionalTypes1.ts, 350, 26)) +>Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 353, 15)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 354, 5)) +>Struct : Symbol(Struct, Decl(conditionalTypes1.ts, 353, 15)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 354, 5)) } // Repro from #22985 type RecursivePartial = { ->RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 339, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 343, 22)) +>RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 355, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 359, 22)) [P in keyof T]?: T[P] extends Array ? {[index: number]: RecursivePartial} : ->P : Symbol(P, Decl(conditionalTypes1.ts, 344, 3)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 343, 22)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 343, 22)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 344, 3)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 360, 3)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 359, 22)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 359, 22)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 360, 3)) >Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) ->index : Symbol(index, Decl(conditionalTypes1.ts, 344, 47)) ->RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 339, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 343, 22)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 344, 3)) +>index : Symbol(index, Decl(conditionalTypes1.ts, 360, 47)) +>RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 355, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 359, 22)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 360, 3)) T[P] extends object ? RecursivePartial : T[P]; ->T : Symbol(T, Decl(conditionalTypes1.ts, 343, 22)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 344, 3)) ->RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 339, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 343, 22)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 344, 3)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 343, 22)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 344, 3)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 359, 22)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 360, 3)) +>RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 355, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 359, 22)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 360, 3)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 359, 22)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 360, 3)) }; declare function assign(o: T, a: RecursivePartial): void; ->assign : Symbol(assign, Decl(conditionalTypes1.ts, 346, 2)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 348, 24)) ->o : Symbol(o, Decl(conditionalTypes1.ts, 348, 27)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 348, 24)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 348, 32)) ->RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 339, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 348, 24)) +>assign : Symbol(assign, Decl(conditionalTypes1.ts, 362, 2)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 364, 24)) +>o : Symbol(o, Decl(conditionalTypes1.ts, 364, 27)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 364, 24)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 364, 32)) +>RecursivePartial : Symbol(RecursivePartial, Decl(conditionalTypes1.ts, 355, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 364, 24)) var a = {o: 1, b: 2, c: [{a: 1, c: '213'}]} ->a : Symbol(a, Decl(conditionalTypes1.ts, 350, 3)) ->o : Symbol(o, Decl(conditionalTypes1.ts, 350, 9)) ->b : Symbol(b, Decl(conditionalTypes1.ts, 350, 14)) ->c : Symbol(c, Decl(conditionalTypes1.ts, 350, 20)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 350, 26)) ->c : Symbol(c, Decl(conditionalTypes1.ts, 350, 31)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 366, 3)) +>o : Symbol(o, Decl(conditionalTypes1.ts, 366, 9)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 366, 14)) +>c : Symbol(c, Decl(conditionalTypes1.ts, 366, 20)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 366, 26)) +>c : Symbol(c, Decl(conditionalTypes1.ts, 366, 31)) assign(a, {o: 2, c: {0: {a: 2, c: '213123'}}}) ->assign : Symbol(assign, Decl(conditionalTypes1.ts, 346, 2)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 350, 3)) ->o : Symbol(o, Decl(conditionalTypes1.ts, 351, 11)) ->c : Symbol(c, Decl(conditionalTypes1.ts, 351, 16)) ->0 : Symbol(0, Decl(conditionalTypes1.ts, 351, 21)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 351, 25)) ->c : Symbol(c, Decl(conditionalTypes1.ts, 351, 30)) +>assign : Symbol(assign, Decl(conditionalTypes1.ts, 362, 2)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 366, 3)) +>o : Symbol(o, Decl(conditionalTypes1.ts, 367, 11)) +>c : Symbol(c, Decl(conditionalTypes1.ts, 367, 16)) +>0 : Symbol(0, Decl(conditionalTypes1.ts, 367, 21)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 367, 25)) +>c : Symbol(c, Decl(conditionalTypes1.ts, 367, 30)) // Repros from #23843 type Weird1 = ((a: U) => never) extends ->Weird1 : Symbol(Weird1, Decl(conditionalTypes1.ts, 351, 46)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 355, 16)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 355, 35)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 355, 16)) +>Weird1 : Symbol(Weird1, Decl(conditionalTypes1.ts, 367, 46)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 371, 16)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 371, 35)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 371, 16)) ((a: U) => never) ? never : never; ->U : Symbol(U, Decl(conditionalTypes1.ts, 356, 6)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 356, 22)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 356, 6)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 372, 6)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 372, 22)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 372, 6)) type Weird2 = ((a: U) => U) extends ->Weird2 : Symbol(Weird2, Decl(conditionalTypes1.ts, 356, 54)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 358, 16)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 358, 35)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 358, 16)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 358, 16)) +>Weird2 : Symbol(Weird2, Decl(conditionalTypes1.ts, 372, 54)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 374, 16)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 374, 35)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 374, 16)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 374, 16)) ((a: U) => infer T) ? T : never; ->U : Symbol(U, Decl(conditionalTypes1.ts, 359, 6)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 359, 22)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 359, 6)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 359, 36)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 359, 36)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 375, 6)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 375, 22)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 375, 6)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 375, 36)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 375, 36)) diff --git a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.types b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.types index b5496f00171d2..e8b86af12d4f4 100644 --- a/tsc/testdata/baselines/reference/conformance/conditionalTypes1.types +++ b/tsc/testdata/baselines/reference/conformance/conditionalTypes1.types @@ -691,6 +691,40 @@ function f23(x: T extends (infer U)[] ? U[] : never) { >0 : 0 } +function inferTuple(x: T extends [infer U, infer V] ? [U, V] : never) { +>inferTuple : (x: T extends [infer U, infer V] ? [U, V] : never) => T extends [infer U, infer V] ? [U, V] : never +>x : T extends [infer U, infer V] ? [U, V] : never + + return x; +>x : T extends [infer U, infer V] ? [U, V] : never +} + +function inferObject(x: T extends { value: infer U } ? { value: U } : never) { +>inferObject : (x: T extends { value: infer U; } ? { value: U; } : never) => T extends { value: infer U; } ? { value: U; } : never +>x : T extends { value: infer U; } ? { value: U; } : never +>value : U +>value : U + + return x; +>x : T extends { value: infer U; } ? { value: U; } : never +} + +function inferFunction(x: T extends () => infer U ? () => U : never) { +>inferFunction : (x: T extends () => infer U ? () => U : never) => T extends () => infer U ? () => U : never +>x : T extends () => infer U ? () => U : never + + return x; +>x : T extends () => infer U ? () => U : never +} + +function inferNested(x: T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never) { +>inferNested : (x: T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never) => T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never +>x : T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never + + return x; +>x : T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never +} + // Repros from #21664 type Eq = T extends U ? U extends T ? true : false : false; diff --git a/tsc/testdata/baselines/reference/tsc/incremental/recursive-tagged-tuple-after-incremental-edits.js b/tsc/testdata/baselines/reference/tsc/incremental/recursive-tagged-tuple-after-incremental-edits.js new file mode 100644 index 0000000000000..4b5a5ad527188 --- /dev/null +++ b/tsc/testdata/baselines/reference/tsc/incremental/recursive-tagged-tuple-after-incremental-edits.js @@ -0,0 +1,700 @@ +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/tslibs/TS/Lib/lib.es2026.full.d.ts] *new* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray { readonly length: number; readonly [n: number]: T; } +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/consumer.ts] *new* +import { doc } from "./doc"; +export const value = doc; +//// [/home/src/workspaces/project/doc.ts] *new* +type Doc = + | string + | { [k: string]: Doc } + | readonly ["array", Doc] + | readonly ["array", Doc, { length: number }] + | readonly ["array", Doc, { min?: number; max?: number }] + | readonly ["union", Doc, ...Doc[]]; +export declare const doc: Doc; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{"compilerOptions": {"strict": true, "incremental": true, "noEmit": true, "module": "esnext", "moduleResolution": "bundler"}} + +tsgo +ExitStatus:: Success +Output:: +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.es2026.full.d.ts","./doc.ts","./consumer.ts"],"fileInfos":[{"version":"0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"5fa9a45d6461d373d994072ba4b41eca-type Doc =\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;","e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;"],"fileIdsList":[[2]],"options":{"module":99,"strict":true},"referencedMap":[[3,1]],"affectedFilesPendingEmit":[3,2]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "./doc.ts", + "./consumer.ts" + ], + "original": [ + 2, + 3 + ] + } + ], + "fileNames": [ + "lib.es2026.full.d.ts", + "./doc.ts", + "./consumer.ts" + ], + "fileInfos": [ + { + "fileName": "lib.es2026.full.d.ts", + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "signature": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./doc.ts", + "version": "5fa9a45d6461d373d994072ba4b41eca-type Doc =\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;", + "signature": "5fa9a45d6461d373d994072ba4b41eca-type Doc =\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./consumer.ts", + "version": "e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;", + "signature": "e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./doc.ts" + ] + ], + "options": { + "module": 99, + "strict": true + }, + "referencedMap": { + "./consumer.ts": [ + "./doc.ts" + ] + }, + "affectedFilesPendingEmit": [ + [ + "./consumer.ts", + "Js", + 3 + ], + [ + "./doc.ts", + "Js", + 2 + ] + ], + "size": 1464 +} + +tsconfig.json:: +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.es2026.full.d.ts +*refresh* /home/src/workspaces/project/doc.ts +*refresh* /home/src/workspaces/project/consumer.ts +Signatures:: + + +Edit [0]:: no change + +tsgo +ExitStatus:: Success +Output:: + +tsconfig.json:: +SemanticDiagnostics:: +Signatures:: + + +Edit [1]:: add a comment to the recursive type +//// [/home/src/workspaces/project/doc.ts] *modified* +type Doc = + | string + | { [k: string]: Doc } + | readonly ["array", Doc] + | readonly ["array", Doc, { length: number }] + | readonly ["array", Doc, { min?: number; max?: number }] + | readonly ["union", Doc, ...Doc[]]; +export declare const doc: Doc; +// comment-only edit + + +tsgo +ExitStatus:: Success +Output:: +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.es2026.full.d.ts","./doc.ts","./consumer.ts"],"fileInfos":[{"version":"0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"209790a380ab2edc475c402e3a85e110-type Doc =\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n","signature":"17befdf8983ce76b78c64e0ef9b49c73-type Doc = string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n","impliedNodeFormat":1},{"version":"e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;","signature":"a56617d7ff45ff02880e982e94937f59-export declare const value: any;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99,"strict":true},"referencedMap":[[3,1]],"affectedFilesPendingEmit":[3,2]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "./doc.ts", + "./consumer.ts" + ], + "original": [ + 2, + 3 + ] + } + ], + "fileNames": [ + "lib.es2026.full.d.ts", + "./doc.ts", + "./consumer.ts" + ], + "fileInfos": [ + { + "fileName": "lib.es2026.full.d.ts", + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "signature": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./doc.ts", + "version": "209790a380ab2edc475c402e3a85e110-type Doc =\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "signature": "17befdf8983ce76b78c64e0ef9b49c73-type Doc = string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "209790a380ab2edc475c402e3a85e110-type Doc =\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "signature": "17befdf8983ce76b78c64e0ef9b49c73-type Doc = string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./consumer.ts", + "version": "e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;", + "signature": "a56617d7ff45ff02880e982e94937f59-export declare const value: any;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;", + "signature": "a56617d7ff45ff02880e982e94937f59-export declare const value: any;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./doc.ts" + ] + ], + "options": { + "module": 99, + "strict": true + }, + "referencedMap": { + "./consumer.ts": [ + "./doc.ts" + ] + }, + "affectedFilesPendingEmit": [ + [ + "./consumer.ts", + "Js", + 3 + ], + [ + "./doc.ts", + "Js", + 2 + ] + ], + "size": 2108 +} + +tsconfig.json:: +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/doc.ts +*refresh* /home/src/workspaces/project/consumer.ts +Signatures:: +(computed .d.ts) /home/src/workspaces/project/doc.ts +(computed .d.ts) /home/src/workspaces/project/consumer.ts + + +Edit [2]:: no change + +tsgo +ExitStatus:: Success +Output:: + +tsconfig.json:: +SemanticDiagnostics:: +Signatures:: + + +Edit [3]:: add a union constituent +//// [/home/src/workspaces/project/doc.ts] *modified* +type Doc = + | number + | string + | { [k: string]: Doc } + | readonly ["array", Doc] + | readonly ["array", Doc, { length: number }] + | readonly ["array", Doc, { min?: number; max?: number }] + | readonly ["union", Doc, ...Doc[]]; +export declare const doc: Doc; +// comment-only edit + + +tsgo +ExitStatus:: Success +Output:: +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.es2026.full.d.ts","./doc.ts","./consumer.ts"],"fileInfos":[{"version":"0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n","signature":"e0d759702454fa5818ea5747e4408ca8-type Doc = number | string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n","impliedNodeFormat":1},{"version":"e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;","signature":"a56617d7ff45ff02880e982e94937f59-export declare const value: any;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99,"strict":true},"referencedMap":[[3,1]],"affectedFilesPendingEmit":[3,2]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "./doc.ts", + "./consumer.ts" + ], + "original": [ + 2, + 3 + ] + } + ], + "fileNames": [ + "lib.es2026.full.d.ts", + "./doc.ts", + "./consumer.ts" + ], + "fileInfos": [ + { + "fileName": "lib.es2026.full.d.ts", + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "signature": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./doc.ts", + "version": "703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "signature": "e0d759702454fa5818ea5747e4408ca8-type Doc = number | string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "signature": "e0d759702454fa5818ea5747e4408ca8-type Doc = number | string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./consumer.ts", + "version": "e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;", + "signature": "a56617d7ff45ff02880e982e94937f59-export declare const value: any;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e3e1863b40b48bf670281f2578788e0b-import { doc } from \"./doc\";\nexport const value = doc;", + "signature": "a56617d7ff45ff02880e982e94937f59-export declare const value: any;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./doc.ts" + ] + ], + "options": { + "module": 99, + "strict": true + }, + "referencedMap": { + "./consumer.ts": [ + "./doc.ts" + ] + }, + "affectedFilesPendingEmit": [ + [ + "./consumer.ts", + "Js", + 3 + ], + [ + "./doc.ts", + "Js", + 2 + ] + ], + "size": 2131 +} + +tsconfig.json:: +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/doc.ts +*refresh* /home/src/workspaces/project/consumer.ts +Signatures:: +(computed .d.ts) /home/src/workspaces/project/doc.ts +(computed .d.ts) /home/src/workspaces/project/consumer.ts + + +Edit [4]:: no change + +tsgo +ExitStatus:: Success +Output:: + +tsconfig.json:: +SemanticDiagnostics:: +Signatures:: + + +Edit [5]:: verify the consumer type was not weakened +//// [/home/src/workspaces/project/consumer.ts] *modified* +import { doc } from "./doc"; +export const value = doc; +export const invalid: number = value; + + +tsgo +ExitStatus:: DiagnosticsPresent_OutputsGenerated +Output:: +consumer.ts:3:14 - error TS2322: Type 'Doc' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. + +3 export const invalid: number = value; +   ~~~~~~~ + + +Found 1 error in consumer.ts:3 + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.es2026.full.d.ts","./doc.ts","./consumer.ts"],"fileInfos":[{"version":"0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n","signature":"e0d759702454fa5818ea5747e4408ca8-type Doc = number | string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n","impliedNodeFormat":1},{"version":"8af491d326de0701fb4d07a415b35dec-import { doc } from \"./doc\";\nexport const value = doc;\nexport const invalid: number = value;\n","signature":"b0465247e2bd6863c6a086f723d673e8-export declare const value: any;\nexport declare const invalid: number;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99,"strict":true},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":68,"end":75,"code":2322,"category":1,"messageKey":"Type_0_is_not_assignable_to_type_1_2322","messageArgs":["Doc","number"],"messageChain":[{"pos":68,"end":75,"code":2322,"category":1,"messageKey":"Type_0_is_not_assignable_to_type_1_2322","messageArgs":["string","number"]}]}]]],"affectedFilesPendingEmit":[3,2]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "./doc.ts", + "./consumer.ts" + ], + "original": [ + 2, + 3 + ] + } + ], + "fileNames": [ + "lib.es2026.full.d.ts", + "./doc.ts", + "./consumer.ts" + ], + "fileInfos": [ + { + "fileName": "lib.es2026.full.d.ts", + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "signature": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./doc.ts", + "version": "703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "signature": "e0d759702454fa5818ea5747e4408ca8-type Doc = number | string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "signature": "e0d759702454fa5818ea5747e4408ca8-type Doc = number | string | {\n [k: string]: Doc;\n} | readonly [\"array\", Doc] | readonly [\"array\", Doc, {\n length: number;\n}] | readonly [\"array\", Doc, {\n min?: number;\n max?: number;\n}] | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\nexport {};\n", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./consumer.ts", + "version": "8af491d326de0701fb4d07a415b35dec-import { doc } from \"./doc\";\nexport const value = doc;\nexport const invalid: number = value;\n", + "signature": "b0465247e2bd6863c6a086f723d673e8-export declare const value: any;\nexport declare const invalid: number;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8af491d326de0701fb4d07a415b35dec-import { doc } from \"./doc\";\nexport const value = doc;\nexport const invalid: number = value;\n", + "signature": "b0465247e2bd6863c6a086f723d673e8-export declare const value: any;\nexport declare const invalid: number;\n\n(42,5): error5088: The_inferred_type_of_0_references_a_type_with_a_cyclic_structure_which_cannot_be_trivially_serialize_5088\nvalue\n", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./doc.ts" + ] + ], + "options": { + "module": 99, + "strict": true + }, + "referencedMap": { + "./consumer.ts": [ + "./doc.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + [ + "./consumer.ts", + [ + { + "pos": 68, + "end": 75, + "code": 2322, + "category": 1, + "messageKey": "Type_0_is_not_assignable_to_type_1_2322", + "messageArgs": [ + "Doc", + "number" + ], + "messageChain": [ + { + "pos": 68, + "end": 75, + "code": 2322, + "category": 1, + "messageKey": "Type_0_is_not_assignable_to_type_1_2322", + "messageArgs": [ + "string", + "number" + ] + } + ] + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./consumer.ts", + "Js", + 3 + ], + [ + "./doc.ts", + "Js", + 2 + ] + ], + "size": 2530 +} + +tsconfig.json:: +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/consumer.ts +Signatures:: +(computed .d.ts) /home/src/workspaces/project/consumer.ts + + +Edit [6]:: no change + +tsgo +ExitStatus:: DiagnosticsPresent_OutputsGenerated +Output:: +consumer.ts:3:14 - error TS2322: Type 'Doc' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. + +3 export const invalid: number = value; +   ~~~~~~~ + + +Found 1 error in consumer.ts:3 + + +tsconfig.json:: +SemanticDiagnostics:: +Signatures:: + + +Edit [7]:: delete build info and check the edited source afresh +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *deleted* + +tsgo +ExitStatus:: DiagnosticsPresent_OutputsGenerated +Output:: +consumer.ts:3:14 - error TS2322: Type 'Doc' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. + +3 export const invalid: number = value; +   ~~~~~~~ + + +Found 1 error in consumer.ts:3 + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.es2026.full.d.ts","./doc.ts","./consumer.ts"],"fileInfos":[{"version":"0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n","8af491d326de0701fb4d07a415b35dec-import { doc } from \"./doc\";\nexport const value = doc;\nexport const invalid: number = value;\n"],"fileIdsList":[[2]],"options":{"module":99,"strict":true},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":68,"end":75,"code":2322,"category":1,"messageKey":"Type_0_is_not_assignable_to_type_1_2322","messageArgs":["Doc","number"],"messageChain":[{"pos":68,"end":75,"code":2322,"category":1,"messageKey":"Type_0_is_not_assignable_to_type_1_2322","messageArgs":["string","number"]}]}]]],"affectedFilesPendingEmit":[3,2]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "./doc.ts", + "./consumer.ts" + ], + "original": [ + 2, + 3 + ] + } + ], + "fileNames": [ + "lib.es2026.full.d.ts", + "./doc.ts", + "./consumer.ts" + ], + "fileInfos": [ + { + "fileName": "lib.es2026.full.d.ts", + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "signature": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0e330bc1e98a7e2601e4b38548df5e2b-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray { readonly length: number; readonly [n: number]: T; }\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./doc.ts", + "version": "703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "signature": "703658314ddb6e78faa0ecabe01e9319-type Doc =\n | number\n | string\n | { [k: string]: Doc }\n | readonly [\"array\", Doc]\n | readonly [\"array\", Doc, { length: number }]\n | readonly [\"array\", Doc, { min?: number; max?: number }]\n | readonly [\"union\", Doc, ...Doc[]];\nexport declare const doc: Doc;\n// comment-only edit\n", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./consumer.ts", + "version": "8af491d326de0701fb4d07a415b35dec-import { doc } from \"./doc\";\nexport const value = doc;\nexport const invalid: number = value;\n", + "signature": "8af491d326de0701fb4d07a415b35dec-import { doc } from \"./doc\";\nexport const value = doc;\nexport const invalid: number = value;\n", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./doc.ts" + ] + ], + "options": { + "module": 99, + "strict": true + }, + "referencedMap": { + "./consumer.ts": [ + "./doc.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + [ + "./consumer.ts", + [ + { + "pos": 68, + "end": 75, + "code": 2322, + "category": 1, + "messageKey": "Type_0_is_not_assignable_to_type_1_2322", + "messageArgs": [ + "Doc", + "number" + ], + "messageChain": [ + { + "pos": 68, + "end": 75, + "code": 2322, + "category": 1, + "messageKey": "Type_0_is_not_assignable_to_type_1_2322", + "messageArgs": [ + "string", + "number" + ] + } + ] + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./consumer.ts", + "Js", + 3 + ], + [ + "./doc.ts", + "Js", + 2 + ] + ], + "size": 1862 +} + +tsconfig.json:: +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.es2026.full.d.ts +*refresh* /home/src/workspaces/project/doc.ts +*refresh* /home/src/workspaces/project/consumer.ts +Signatures:: + + +Edit [8]:: no change + +tsgo +ExitStatus:: DiagnosticsPresent_OutputsGenerated +Output:: +consumer.ts:3:14 - error TS2322: Type 'Doc' is not assignable to type 'number'. + Type 'string' is not assignable to type 'number'. + +3 export const invalid: number = value; +   ~~~~~~~ + + +Found 1 error in consumer.ts:3 + + +tsconfig.json:: +SemanticDiagnostics:: +Signatures:: diff --git a/tsc/testdata/tests/cases/compiler/recursiveContainerDeclarationSerialization.ts b/tsc/testdata/tests/cases/compiler/recursiveContainerDeclarationSerialization.ts new file mode 100644 index 0000000000000..ecfc99f73a745 --- /dev/null +++ b/tsc/testdata/tests/cases/compiler/recursiveContainerDeclarationSerialization.ts @@ -0,0 +1,36 @@ +// @strict: true +// @declaration: true + +// @filename: local.ts +export function array() { + type Recursive = Recursive[]; + return null as unknown as Recursive; +} +export function tuple() { + type Recursive = [Recursive]; + return null as unknown as Recursive; +} +export function readonlyTuple() { + type Recursive = readonly [Recursive]; + return null as unknown as Recursive; +} +export function union() { + type Recursive = string | Recursive[]; + return null as unknown as Recursive; +} + +// @filename: nameable.ts +export type RecursiveArray = RecursiveArray[]; +export type RecursiveTuple = readonly [RecursiveTuple]; +declare const array: RecursiveArray; +declare const tuple: RecursiveTuple; +export const namedArray = array; +export const namedTuple = tuple; +export function finite() { + type Nested = [[[[[[[[[[[[[number]]]]]]]]]]]]]; + return null as unknown as Nested; +} +export function finiteArray() { + type Nested = number[][][][][][][][][][][][][]; + return null as unknown as Nested; +} diff --git a/tsc/testdata/tests/cases/conformance/types/conditional/conditionalTypes1.ts b/tsc/testdata/tests/cases/conformance/types/conditional/conditionalTypes1.ts index 99c1df6dfa03d..f98d2da442f2d 100644 --- a/tsc/testdata/tests/cases/conformance/types/conditional/conditionalTypes1.ts +++ b/tsc/testdata/tests/cases/conformance/types/conditional/conditionalTypes1.ts @@ -224,6 +224,22 @@ function f23(x: T extends (infer U)[] ? U[] : never) { let e = x[0]; // string } +function inferTuple(x: T extends [infer U, infer V] ? [U, V] : never) { + return x; +} + +function inferObject(x: T extends { value: infer U } ? { value: U } : never) { + return x; +} + +function inferFunction(x: T extends () => infer U ? () => U : never) { + return x; +} + +function inferNested(x: T extends (infer U)[] ? U extends (infer V)[] ? [U[], V[]] : U[] : never) { + return x; +} + // Repros from #21664 type Eq = T extends U ? U extends T ? true : false : false;