diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7da5d747391..cd918ea4dce 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6096,11 +6096,13 @@ namespace ts { // with its constraint. We do this because if the constraint is a union type it will be distributed // over the conditional type and possibly reduced. For example, 'T extends undefined ? never : T' // removes 'undefined' from T. - const checkType = type.checkType; - if (checkType.flags & TypeFlags.TypeParameter) { - const constraint = getConstraintOfTypeParameter(checkType); + if (isDistributiveConditionalType(type)) { + const constraint = getConstraintOfType(type.checkType); if (constraint) { - return instantiateType(type, createTypeMapper([checkType], [constraint])); + const target = type.target || type; + const mapper = createTypeMapper([target.checkType], [constraint]); + const combinedMapper = type.mapper ? combineTypeMappers(mapper, type.mapper) : mapper; + return instantiateType(target, combinedMapper); } } return undefined; @@ -8237,6 +8239,10 @@ namespace ts { return result; } + function isDistributiveConditionalType(type: ConditionalType) { + return !!((type.target || type).checkType.flags & TypeFlags.TypeParameter); + } + function getInferTypeParameters(node: ConditionalTypeNode): TypeParameter[] { let result: TypeParameter[]; if (node.locals) { @@ -8849,9 +8855,9 @@ namespace ts { // Check if we have a conditional type where the check type is a naked type parameter. If so, // the conditional type is distributive over union types and when T is instantiated to a union // type A | B, we produce (A extends U ? X : Y) | (B extends U ? X : Y). - const checkType = target.checkType; - if (checkType.flags & TypeFlags.TypeParameter) { - const instantiatedType = combinedMapper(checkType); + if (isDistributiveConditionalType(target)) { + const checkType = target.checkType; + const instantiatedType = combinedMapper(checkType); if (checkType !== instantiatedType && instantiatedType.flags & TypeFlags.Union) { return mapType(instantiatedType, t => instantiateConditionalType(target, createReplacementMapper(checkType, t, combinedMapper))); } @@ -9628,17 +9634,43 @@ namespace ts { function isIdenticalTo(source: Type, target: Type): Ternary { let result: Ternary; - if (source.flags & TypeFlags.Object && target.flags & TypeFlags.Object) { + const flags = source.flags & target.flags; + if (flags & TypeFlags.Object) { return recursiveTypeRelatedTo(source, target, /*reportErrors*/ false); } - if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union || - source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) { + if (flags & (TypeFlags.Union | TypeFlags.Intersection)) { if (result = eachTypeRelatedToSomeType(source, target)) { if (result &= eachTypeRelatedToSomeType(target, source)) { return result; } } } + if (flags & TypeFlags.Index) { + return isRelatedTo((source).type, (target).type, /*reportErrors*/ false); + } + if (flags & TypeFlags.IndexedAccess) { + if (result = isRelatedTo((source).objectType, (target).objectType, /*reportErrors*/ false)) { + if (result &= isRelatedTo((source).indexType, (target).indexType, /*reportErrors*/ false)) { + return result; + } + } + } + if (flags & TypeFlags.Conditional) { + if (result = isRelatedTo((source).checkType, (target).checkType, /*reportErrors*/ false)) { + if (result &= isRelatedTo((source).extendsType, (target).extendsType, /*reportErrors*/ false)) { + if (result &= isRelatedTo((source).trueType, (target).trueType, /*reportErrors*/ false)) { + if (result &= isRelatedTo((source).falseType, (target).falseType, /*reportErrors*/ false)) { + if (isDistributiveConditionalType(source) === isDistributiveConditionalType(target)) { + return result; + } + } + } + } + } + } + if (flags & TypeFlags.Substitution) { + return isRelatedTo((source).substitute, (target).substitute, /*reportErrors*/ false); + } return Ternary.False; } @@ -10024,7 +10056,19 @@ namespace ts { } } } - if (result = isRelatedTo(getDefaultConstraintOfConditionalType(source), target, reportErrors)) { + if (target.flags & TypeFlags.Conditional) { + if (isTypeIdenticalTo((source).checkType, (target).checkType) && + isTypeIdenticalTo((source).extendsType, (target).extendsType)) { + if (result = isRelatedTo((source).trueType, (target).trueType, reportErrors)) { + result &= isRelatedTo((source).falseType, (target).falseType, reportErrors); + } + if (result) { + errorInfo = saveErrorInfo; + return result; + } + } + } + else if (result = isRelatedTo(getDefaultConstraintOfConditionalType(source), target, reportErrors)) { errorInfo = saveErrorInfo; return result; } diff --git a/tests/baselines/reference/conditionalTypes1.errors.txt b/tests/baselines/reference/conditionalTypes1.errors.txt index 111b74a830b..b79ec721e97 100644 --- a/tests/baselines/reference/conditionalTypes1.errors.txt +++ b/tests/baselines/reference/conditionalTypes1.errors.txt @@ -8,9 +8,15 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(18,9): error TS23 tests/cases/conformance/types/conditional/conditionalTypes1.ts(24,5): error TS2322: Type 'Partial[keyof T]' is not assignable to type 'NonNullable[keyof T]>'. Type 'T[keyof T] | undefined' is not assignable to type 'NonNullable[keyof T]>'. Type 'undefined' is not assignable to type 'NonNullable[keyof T]>'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(96,5): error TS2322: Type 'Pick' is not assignable to type 'T'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(97,5): error TS2322: Type 'Pick' is not assignable to type 'T'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(99,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(29,5): error TS2322: Type 'T["x"]' is not assignable to type 'NonNullable'. + Type 'string | undefined' is not assignable to type 'NonNullable'. + Type 'undefined' is not assignable to type 'NonNullable'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(30,9): error TS2322: Type 'T["x"]' is not assignable to type 'string'. + Type 'string | undefined' is not assignable to type 'string'. + Type 'undefined' is not assignable to type 'string'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(103,5): error TS2322: Type 'Pick' is not assignable to type 'T'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(104,5): error TS2322: Type 'Pick' is not assignable to type 'T'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(106,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. @@ -18,8 +24,8 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(99,5): error TS23 Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. - Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(101,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. + Type 'keyof T' is not assignable to type 'never'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type 'Pick' is not assignable to type 'Pick'. Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. @@ -27,41 +33,43 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(101,5): error TS2 Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. - Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(107,5): error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. + Type 'keyof T' is not assignable to type 'never'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(114,5): error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(108,5): error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(115,5): error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]'. Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. - Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(109,5): error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. + Type 'keyof T' is not assignable to type 'never'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(116,5): error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(110,5): error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(117,5): error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. - Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(127,10): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(128,5): error TS2542: Index signature in type 'DeepReadonlyArray' only permits reading. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(129,22): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(130,10): error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(152,5): error TS2322: Type 'ZeroOf' is not assignable to type 'T'. + Type 'keyof T' is not assignable to type 'never'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(134,10): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(135,5): error TS2542: Index signature in type 'DeepReadonlyArray' only permits reading. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(136,22): error TS2540: Cannot assign to 'id' because it is a constant or a read-only property. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(137,10): error TS2339: Property 'updatePart' does not exist on type 'DeepReadonlyObject'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2322: Type 'ZeroOf' is not assignable to type 'T'. Type '0 | (T extends string ? "" : false)' is not assignable to type 'T'. Type '0' is not assignable to type 'T'. Type '"" | 0' is not assignable to type 'T'. Type '""' is not assignable to type 'T'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(153,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf'. +tests/cases/conformance/types/conditional/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'. -tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(250,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo'. +tests/cases/conformance/types/conditional/conditionalTypes1.ts(275,43): error TS2322: Type 'T95' is not assignable to type 'T94'. + Type 'boolean' is not assignable to type 'true'. -==== tests/cases/conformance/types/conditional/conditionalTypes1.ts (19 errors) ==== +==== tests/cases/conformance/types/conditional/conditionalTypes1.ts (22 errors) ==== type T00 = Exclude<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "b" | "d" type T01 = Extract<"a" | "b" | "c" | "d", "a" | "c" | "f">; // "a" | "c" @@ -102,6 +110,21 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 !!! error TS2322: Type 'undefined' is not assignable to type 'NonNullable[keyof T]>'. } + function f4(x: T["x"], y: NonNullable) { + x = y; + y = x; // Error + ~ +!!! error TS2322: Type 'T["x"]' is not assignable to type 'NonNullable'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'NonNullable'. +!!! error TS2322: Type 'undefined' is not assignable to type 'NonNullable'. + let s1: string = x; // Error + ~~ +!!! error TS2322: Type 'T["x"]' is not assignable to type 'string'. +!!! error TS2322: Type 'string | undefined' is not assignable to type 'string'. +!!! error TS2322: Type 'undefined' is not assignable to type 'string'. + let s2: string = y; + } + type Options = { k: "a", a: number } | { k: "b", b: string } | { k: "c", c: boolean }; type T10 = Exclude; // { k: "c", c: boolean } @@ -113,8 +136,8 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 type T14 = Exclude; // Options type T15 = Extract; // never - declare function f4(p: K): Extract; - let x0 = f4("a"); // { k: "a", a: number } + declare function f5(p: K): Extract; + let x0 = f5("a"); // { k: "a", a: number } type OptionsOfKind = Extract; @@ -188,7 +211,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 !!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. !!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. !!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. -!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. z = x; z = y; // Error ~ @@ -200,7 +223,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 !!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. !!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. !!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. -!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. } function f8(x: keyof T, y: FunctionPropertyNames, z: NonFunctionPropertyNames) { @@ -218,7 +241,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 !!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. !!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. !!! error TS2322: Type 'T[keyof T] extends Function ? never : keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. -!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? keyof T : never'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. z = x; // Error ~ !!! error TS2322: Type 'keyof T' is not assignable to type '{ [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]'. @@ -231,7 +254,7 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 !!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. !!! error TS2322: Type '{ [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. !!! error TS2322: Type 'T[keyof T] extends Function ? keyof T : never' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. -!!! error TS2322: Type 'keyof T' is not assignable to type 'T[keyof T] extends Function ? never : keyof T'. +!!! error TS2322: Type 'keyof T' is not assignable to type 'never'. } type DeepReadonly = @@ -393,4 +416,24 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(243,9): error TS2 var z: T1; var z: T2; } + + // Repro from #21823 + + type T90 = T extends 0 ? 0 : () => 0; + type T91 = T extends 0 ? 0 : () => 0; + const f40 = (a: T90): T91 => a; + const f41 = (a: T91): T90 => a; + + type T92 = T extends () => 0 ? () => 1 : () => 2; + type T93 = T extends () => 0 ? () => 1 : () => 2; + const f42 = (a: T92): T93 => a; + const f43 = (a: T93): T92 => a; + + type T94 = T extends string ? true : 42; + type T95 = T extends string ? boolean : number; + const f44 = (value: T94): T95 => value; + const f45 = (value: T95): T94 => value; // Error + ~~~~~ +!!! error TS2322: Type 'T95' is not assignable to type 'T94'. +!!! error TS2322: Type 'boolean' is not assignable to type 'true'. \ No newline at end of file diff --git a/tests/baselines/reference/conditionalTypes1.js b/tests/baselines/reference/conditionalTypes1.js index 399ccb14fb3..fe617d777ca 100644 --- a/tests/baselines/reference/conditionalTypes1.js +++ b/tests/baselines/reference/conditionalTypes1.js @@ -25,6 +25,13 @@ function f3(x: Partial[keyof T], y: NonNullable[keyof T]>) { y = x; // Error } +function f4(x: T["x"], y: NonNullable) { + x = y; + y = x; // Error + let s1: string = x; // Error + let s2: string = y; +} + type Options = { k: "a", a: number } | { k: "b", b: string } | { k: "c", c: boolean }; type T10 = Exclude; // { k: "c", c: boolean } @@ -36,8 +43,8 @@ type T13 = Extract; // { k: "a", a: number } type T14 = Exclude; // Options type T15 = Extract; // never -declare function f4(p: K): Extract; -let x0 = f4("a"); // { k: "a", a: number } +declare function f5(p: K): Extract; +let x0 = f5("a"); // { k: "a", a: number } type OptionsOfKind = Extract; @@ -250,6 +257,23 @@ function f33() { var z: T1; var z: T2; } + +// Repro from #21823 + +type T90 = T extends 0 ? 0 : () => 0; +type T91 = T extends 0 ? 0 : () => 0; +const f40 = (a: T90): T91 => a; +const f41 = (a: T91): T90 => a; + +type T92 = T extends () => 0 ? () => 1 : () => 2; +type T93 = T extends () => 0 ? () => 1 : () => 2; +const f42 = (a: T92): T93 => a; +const f43 = (a: T93): T92 => a; + +type T94 = T extends string ? true : 42; +type T95 = T extends string ? boolean : number; +const f44 = (value: T94): T95 => value; +const f45 = (value: T95): T94 => value; // Error //// [conditionalTypes1.js] @@ -268,7 +292,13 @@ function f3(x, y) { x = y; y = x; // Error } -var x0 = f4("a"); // { k: "a", a: number } +function f4(x, y) { + x = y; + y = x; // Error + var s1 = x; // Error + var s2 = y; +} +var x0 = f5("a"); // { k: "a", a: number } function f7(x, y, z) { x = y; // Error x = z; // Error @@ -325,6 +355,12 @@ function f33() { var z; var z; } +var f40 = function (a) { return a; }; +var f41 = function (a) { return a; }; +var f42 = function (a) { return a; }; +var f43 = function (a) { return a; }; +var f44 = function (value) { return value; }; +var f45 = function (value) { return value; }; // Error //// [conditionalTypes1.d.ts] @@ -337,6 +373,9 @@ declare type T05 = NonNullable<(() => string) | string[] | null | undefined>; declare function f1(x: T, y: NonNullable): void; declare function f2(x: T, y: NonNullable): void; declare function f3(x: Partial[keyof T], y: NonNullable[keyof T]>): void; +declare function f4(x: T["x"], y: NonNullable): void; declare type Options = { k: "a"; a: number; @@ -369,7 +408,7 @@ declare type T14 = Exclude; -declare function f4(p: K): Extract(p: K): Extract; declare let x0: { @@ -495,3 +534,15 @@ declare const convert2: (value: Foo) => Foo; declare function f31(): void; declare function f32(): void; declare function f33(): void; +declare type T90 = T extends 0 ? 0 : () => 0; +declare type T91 = T extends 0 ? 0 : () => 0; +declare const f40: (a: T90) => T91; +declare const f41: (a: T91) => T90; +declare type T92 = T extends () => 0 ? () => 1 : () => 2; +declare type T93 = T extends () => 0 ? () => 1 : () => 2; +declare const f42: (a: T92) => T93; +declare const f43: (a: T93) => T92; +declare type T94 = T extends string ? true : 42; +declare type T95 = T extends string ? boolean : number; +declare const f44: (value: T94) => T95; +declare const f45: (value: T95) => T94; diff --git a/tests/baselines/reference/conditionalTypes1.symbols b/tests/baselines/reference/conditionalTypes1.symbols index cef734c4c4b..ef5dc0d58f8 100644 --- a/tests/baselines/reference/conditionalTypes1.symbols +++ b/tests/baselines/reference/conditionalTypes1.symbols @@ -91,852 +91,971 @@ function f3(x: Partial[keyof T], y: NonNullable[keyof T]>) { >x : Symbol(x, Decl(conditionalTypes1.ts, 21, 15)) } +function f4(x: T["x"], y: NonNullable) { +>f4 : Symbol(f4, Decl(conditionalTypes1.ts, 24, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 26, 12)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 26, 23)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 26, 49)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 26, 12)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 26, 59)) +>NonNullable : Symbol(NonNullable, Decl(lib.d.ts, --, --)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 26, 12)) + + x = y; +>x : Symbol(x, Decl(conditionalTypes1.ts, 26, 49)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 26, 59)) + + y = x; // Error +>y : Symbol(y, Decl(conditionalTypes1.ts, 26, 59)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 26, 49)) + + let s1: string = x; // Error +>s1 : Symbol(s1, Decl(conditionalTypes1.ts, 29, 7)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 26, 49)) + + let s2: string = y; +>s2 : Symbol(s2, Decl(conditionalTypes1.ts, 30, 7)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 26, 59)) +} + type Options = { k: "a", a: number } | { k: "b", b: string } | { k: "c", c: boolean }; ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 26, 16)) ->a : Symbol(a, Decl(conditionalTypes1.ts, 26, 24)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 26, 40)) ->b : Symbol(b, Decl(conditionalTypes1.ts, 26, 48)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 26, 64)) ->c : Symbol(c, Decl(conditionalTypes1.ts, 26, 72)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 33, 16)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 33, 24)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 33, 40)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 33, 48)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 33, 64)) +>c : Symbol(c, Decl(conditionalTypes1.ts, 33, 72)) type T10 = Exclude; // { k: "c", c: boolean } ->T10 : Symbol(T10, Decl(conditionalTypes1.ts, 26, 86)) +>T10 : Symbol(T10, Decl(conditionalTypes1.ts, 33, 86)) >Exclude : Symbol(Exclude, Decl(lib.d.ts, --, --)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 28, 29)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 35, 29)) type T11 = Extract; // { k: "a", a: number } | { k: "b", b: string } ->T11 : Symbol(T11, Decl(conditionalTypes1.ts, 28, 46)) +>T11 : Symbol(T11, Decl(conditionalTypes1.ts, 35, 46)) >Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 29, 29)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 36, 29)) type T12 = Exclude; // { k: "c", c: boolean } ->T12 : Symbol(T12, Decl(conditionalTypes1.ts, 29, 46)) +>T12 : Symbol(T12, Decl(conditionalTypes1.ts, 36, 46)) >Exclude : Symbol(Exclude, Decl(lib.d.ts, --, --)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 31, 29)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 31, 42)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 38, 29)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 38, 42)) type T13 = Extract; // { k: "a", a: number } | { k: "b", b: string } ->T13 : Symbol(T13, Decl(conditionalTypes1.ts, 31, 53)) +>T13 : Symbol(T13, Decl(conditionalTypes1.ts, 38, 53)) >Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 32, 29)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 32, 42)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 39, 29)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 39, 42)) type T14 = Exclude; // Options ->T14 : Symbol(T14, Decl(conditionalTypes1.ts, 32, 53)) +>T14 : Symbol(T14, Decl(conditionalTypes1.ts, 39, 53)) >Exclude : Symbol(Exclude, Decl(lib.d.ts, --, --)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->q : Symbol(q, Decl(conditionalTypes1.ts, 34, 29)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>q : Symbol(q, Decl(conditionalTypes1.ts, 41, 29)) type T15 = Extract; // never ->T15 : Symbol(T15, Decl(conditionalTypes1.ts, 34, 40)) +>T15 : Symbol(T15, Decl(conditionalTypes1.ts, 41, 40)) >Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->q : Symbol(q, Decl(conditionalTypes1.ts, 35, 29)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>q : Symbol(q, Decl(conditionalTypes1.ts, 42, 29)) -declare function f4(p: K): Extract; ->f4 : Symbol(f4, Decl(conditionalTypes1.ts, 35, 40)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 37, 20)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 37, 38)) ->p : Symbol(p, Decl(conditionalTypes1.ts, 37, 57)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 37, 38)) +declare function f5(p: K): Extract; +>f5 : Symbol(f5, Decl(conditionalTypes1.ts, 42, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 44, 20)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 44, 38)) +>p : Symbol(p, Decl(conditionalTypes1.ts, 44, 57)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 44, 38)) >Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 37, 20)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 37, 76)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 37, 38)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 44, 20)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 44, 76)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 44, 38)) -let x0 = f4("a"); // { k: "a", a: number } ->x0 : Symbol(x0, Decl(conditionalTypes1.ts, 38, 3)) ->f4 : Symbol(f4, Decl(conditionalTypes1.ts, 35, 40)) +let x0 = f5("a"); // { k: "a", a: number } +>x0 : Symbol(x0, Decl(conditionalTypes1.ts, 45, 3)) +>f5 : Symbol(f5, Decl(conditionalTypes1.ts, 42, 40)) type OptionsOfKind = Extract; ->OptionsOfKind : Symbol(OptionsOfKind, Decl(conditionalTypes1.ts, 38, 17)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 40, 19)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) +>OptionsOfKind : Symbol(OptionsOfKind, Decl(conditionalTypes1.ts, 45, 17)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 47, 19)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) >Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) ->k : Symbol(k, Decl(conditionalTypes1.ts, 40, 63)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 40, 19)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) +>k : Symbol(k, Decl(conditionalTypes1.ts, 47, 63)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 47, 19)) type T16 = OptionsOfKind<"a" | "b">; // { k: "a", a: number } | { k: "b", b: string } ->T16 : Symbol(T16, Decl(conditionalTypes1.ts, 40, 72)) ->OptionsOfKind : Symbol(OptionsOfKind, Decl(conditionalTypes1.ts, 38, 17)) +>T16 : Symbol(T16, Decl(conditionalTypes1.ts, 47, 72)) +>OptionsOfKind : Symbol(OptionsOfKind, Decl(conditionalTypes1.ts, 45, 17)) type Select = Extract; ->Select : Symbol(Select, Decl(conditionalTypes1.ts, 42, 36)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 44, 12)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 44, 14)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 44, 12)) ->V : Symbol(V, Decl(conditionalTypes1.ts, 44, 33)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 44, 12)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 44, 14)) +>Select : Symbol(Select, Decl(conditionalTypes1.ts, 49, 36)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 51, 12)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 51, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 51, 12)) +>V : Symbol(V, Decl(conditionalTypes1.ts, 51, 33)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 51, 12)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 51, 14)) >Extract : Symbol(Extract, Decl(lib.d.ts, --, --)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 44, 12)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 44, 66)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 44, 14)) ->V : Symbol(V, Decl(conditionalTypes1.ts, 44, 33)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 51, 12)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 51, 66)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 51, 14)) +>V : Symbol(V, Decl(conditionalTypes1.ts, 51, 33)) type T17 = Select; // // { k: "a", a: number } | { k: "b", b: string } ->T17 : Symbol(T17, Decl(conditionalTypes1.ts, 44, 80)) ->Select : Symbol(Select, Decl(conditionalTypes1.ts, 42, 36)) ->Options : Symbol(Options, Decl(conditionalTypes1.ts, 24, 1)) +>T17 : Symbol(T17, Decl(conditionalTypes1.ts, 51, 80)) +>Select : Symbol(Select, Decl(conditionalTypes1.ts, 49, 36)) +>Options : Symbol(Options, Decl(conditionalTypes1.ts, 31, 1)) type TypeName = ->TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 46, 43)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 48, 14)) +>TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 53, 43)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 55, 14)) T extends string ? "string" : ->T : Symbol(T, Decl(conditionalTypes1.ts, 48, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 55, 14)) T extends number ? "number" : ->T : Symbol(T, Decl(conditionalTypes1.ts, 48, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 55, 14)) T extends boolean ? "boolean" : ->T : Symbol(T, Decl(conditionalTypes1.ts, 48, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 55, 14)) T extends undefined ? "undefined" : ->T : Symbol(T, Decl(conditionalTypes1.ts, 48, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 55, 14)) T extends Function ? "function" : ->T : Symbol(T, Decl(conditionalTypes1.ts, 48, 14)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 55, 14)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) "object"; type T20 = TypeName void)>; // "string" | "function" ->T20 : Symbol(T20, Decl(conditionalTypes1.ts, 54, 13)) ->TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 46, 43)) +>T20 : Symbol(T20, Decl(conditionalTypes1.ts, 61, 13)) +>TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 53, 43)) type T21 = TypeName; // "string" | "number" | "boolean" | "undefined" | "function" | "object" ->T21 : Symbol(T21, Decl(conditionalTypes1.ts, 56, 43)) ->TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 46, 43)) +>T21 : Symbol(T21, Decl(conditionalTypes1.ts, 63, 43)) +>TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 53, 43)) type T22 = TypeName; // "string" | "number" | "boolean" | "undefined" | "function" | "object" ->T22 : Symbol(T22, Decl(conditionalTypes1.ts, 57, 25)) ->TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 46, 43)) +>T22 : Symbol(T22, Decl(conditionalTypes1.ts, 64, 25)) +>TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 53, 43)) type T23 = TypeName<{}>; // "object" ->T23 : Symbol(T23, Decl(conditionalTypes1.ts, 58, 27)) ->TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 46, 43)) +>T23 : Symbol(T23, Decl(conditionalTypes1.ts, 65, 27)) +>TypeName : Symbol(TypeName, Decl(conditionalTypes1.ts, 53, 43)) type KnockoutObservable = { object: T }; ->KnockoutObservable : Symbol(KnockoutObservable, Decl(conditionalTypes1.ts, 59, 24)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 61, 24)) ->object : Symbol(object, Decl(conditionalTypes1.ts, 61, 30)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 61, 24)) +>KnockoutObservable : Symbol(KnockoutObservable, Decl(conditionalTypes1.ts, 66, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 68, 24)) +>object : Symbol(object, Decl(conditionalTypes1.ts, 68, 30)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 68, 24)) type KnockoutObservableArray = { array: T }; ->KnockoutObservableArray : Symbol(KnockoutObservableArray, Decl(conditionalTypes1.ts, 61, 43)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 62, 29)) ->array : Symbol(array, Decl(conditionalTypes1.ts, 62, 35)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 62, 29)) +>KnockoutObservableArray : Symbol(KnockoutObservableArray, Decl(conditionalTypes1.ts, 68, 43)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 69, 29)) +>array : Symbol(array, Decl(conditionalTypes1.ts, 69, 35)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 69, 29)) type KnockedOut = T extends any[] ? KnockoutObservableArray : KnockoutObservable; ->KnockedOut : Symbol(KnockedOut, Decl(conditionalTypes1.ts, 62, 47)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 64, 16)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 64, 16)) ->KnockoutObservableArray : Symbol(KnockoutObservableArray, Decl(conditionalTypes1.ts, 61, 43)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 64, 16)) ->KnockoutObservable : Symbol(KnockoutObservable, Decl(conditionalTypes1.ts, 59, 24)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 64, 16)) +>KnockedOut : Symbol(KnockedOut, Decl(conditionalTypes1.ts, 69, 47)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 71, 16)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 71, 16)) +>KnockoutObservableArray : Symbol(KnockoutObservableArray, Decl(conditionalTypes1.ts, 68, 43)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 71, 16)) +>KnockoutObservable : Symbol(KnockoutObservable, Decl(conditionalTypes1.ts, 66, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 71, 16)) type KnockedOutObj = { ->KnockedOutObj : Symbol(KnockedOutObj, Decl(conditionalTypes1.ts, 64, 98)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 66, 19)) +>KnockedOutObj : Symbol(KnockedOutObj, Decl(conditionalTypes1.ts, 71, 98)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 73, 19)) [P in keyof T]: KnockedOut; ->P : Symbol(P, Decl(conditionalTypes1.ts, 67, 5)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 66, 19)) ->KnockedOut : Symbol(KnockedOut, Decl(conditionalTypes1.ts, 62, 47)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 66, 19)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 67, 5)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 74, 5)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 73, 19)) +>KnockedOut : Symbol(KnockedOut, Decl(conditionalTypes1.ts, 69, 47)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 73, 19)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 74, 5)) } interface Item { ->Item : Symbol(Item, Decl(conditionalTypes1.ts, 68, 1)) +>Item : Symbol(Item, Decl(conditionalTypes1.ts, 75, 1)) id: number; ->id : Symbol(Item.id, Decl(conditionalTypes1.ts, 70, 16)) +>id : Symbol(Item.id, Decl(conditionalTypes1.ts, 77, 16)) name: string; ->name : Symbol(Item.name, Decl(conditionalTypes1.ts, 71, 15)) +>name : Symbol(Item.name, Decl(conditionalTypes1.ts, 78, 15)) subitems: string[]; ->subitems : Symbol(Item.subitems, Decl(conditionalTypes1.ts, 72, 17)) +>subitems : Symbol(Item.subitems, Decl(conditionalTypes1.ts, 79, 17)) } type KOItem = KnockedOutObj; ->KOItem : Symbol(KOItem, Decl(conditionalTypes1.ts, 74, 1)) ->KnockedOutObj : Symbol(KnockedOutObj, Decl(conditionalTypes1.ts, 64, 98)) ->Item : Symbol(Item, Decl(conditionalTypes1.ts, 68, 1)) +>KOItem : Symbol(KOItem, Decl(conditionalTypes1.ts, 81, 1)) +>KnockedOutObj : Symbol(KnockedOutObj, Decl(conditionalTypes1.ts, 71, 98)) +>Item : Symbol(Item, Decl(conditionalTypes1.ts, 75, 1)) interface Part { ->Part : Symbol(Part, Decl(conditionalTypes1.ts, 76, 34)) +>Part : Symbol(Part, Decl(conditionalTypes1.ts, 83, 34)) id: number; ->id : Symbol(Part.id, Decl(conditionalTypes1.ts, 78, 16)) +>id : Symbol(Part.id, Decl(conditionalTypes1.ts, 85, 16)) name: string; ->name : Symbol(Part.name, Decl(conditionalTypes1.ts, 79, 15)) +>name : Symbol(Part.name, Decl(conditionalTypes1.ts, 86, 15)) subparts: Part[]; ->subparts : Symbol(Part.subparts, Decl(conditionalTypes1.ts, 80, 17)) ->Part : Symbol(Part, Decl(conditionalTypes1.ts, 76, 34)) +>subparts : Symbol(Part.subparts, Decl(conditionalTypes1.ts, 87, 17)) +>Part : Symbol(Part, Decl(conditionalTypes1.ts, 83, 34)) updatePart(newName: string): void; ->updatePart : Symbol(Part.updatePart, Decl(conditionalTypes1.ts, 81, 21)) ->newName : Symbol(newName, Decl(conditionalTypes1.ts, 82, 15)) +>updatePart : Symbol(Part.updatePart, Decl(conditionalTypes1.ts, 88, 21)) +>newName : Symbol(newName, Decl(conditionalTypes1.ts, 89, 15)) } type FunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T]; ->FunctionPropertyNames : Symbol(FunctionPropertyNames, Decl(conditionalTypes1.ts, 83, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 85, 27)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 85, 35)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 85, 27)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 85, 27)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 85, 35)) +>FunctionPropertyNames : Symbol(FunctionPropertyNames, Decl(conditionalTypes1.ts, 90, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 92, 27)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 92, 35)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 92, 27)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 92, 27)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 92, 35)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 85, 35)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 85, 27)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 92, 35)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 92, 27)) type FunctionProperties = Pick>; ->FunctionProperties : Symbol(FunctionProperties, Decl(conditionalTypes1.ts, 85, 95)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 86, 24)) +>FunctionProperties : Symbol(FunctionProperties, Decl(conditionalTypes1.ts, 92, 95)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 93, 24)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 86, 24)) ->FunctionPropertyNames : Symbol(FunctionPropertyNames, Decl(conditionalTypes1.ts, 83, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 86, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 93, 24)) +>FunctionPropertyNames : Symbol(FunctionPropertyNames, Decl(conditionalTypes1.ts, 90, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 93, 24)) type NonFunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T]; ->NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 86, 63)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 88, 30)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 88, 38)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 88, 30)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 88, 30)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 88, 38)) +>NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 93, 63)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 95, 30)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 95, 38)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 95, 30)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 95, 30)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 95, 38)) >Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --)) ->K : Symbol(K, Decl(conditionalTypes1.ts, 88, 38)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 88, 30)) +>K : Symbol(K, Decl(conditionalTypes1.ts, 95, 38)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 95, 30)) type NonFunctionProperties = Pick>; ->NonFunctionProperties : Symbol(NonFunctionProperties, Decl(conditionalTypes1.ts, 88, 98)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 89, 27)) +>NonFunctionProperties : Symbol(NonFunctionProperties, Decl(conditionalTypes1.ts, 95, 98)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 96, 27)) >Pick : Symbol(Pick, Decl(lib.d.ts, --, --)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 89, 27)) ->NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 86, 63)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 89, 27)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 96, 27)) +>NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 93, 63)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 96, 27)) type T30 = FunctionProperties; ->T30 : Symbol(T30, Decl(conditionalTypes1.ts, 89, 69)) ->FunctionProperties : Symbol(FunctionProperties, Decl(conditionalTypes1.ts, 85, 95)) ->Part : Symbol(Part, Decl(conditionalTypes1.ts, 76, 34)) +>T30 : Symbol(T30, Decl(conditionalTypes1.ts, 96, 69)) +>FunctionProperties : Symbol(FunctionProperties, Decl(conditionalTypes1.ts, 92, 95)) +>Part : Symbol(Part, Decl(conditionalTypes1.ts, 83, 34)) type T31 = NonFunctionProperties; ->T31 : Symbol(T31, Decl(conditionalTypes1.ts, 91, 36)) ->NonFunctionProperties : Symbol(NonFunctionProperties, Decl(conditionalTypes1.ts, 88, 98)) ->Part : Symbol(Part, Decl(conditionalTypes1.ts, 76, 34)) +>T31 : Symbol(T31, Decl(conditionalTypes1.ts, 98, 36)) +>NonFunctionProperties : Symbol(NonFunctionProperties, Decl(conditionalTypes1.ts, 95, 98)) +>Part : Symbol(Part, Decl(conditionalTypes1.ts, 83, 34)) function f7(x: T, y: FunctionProperties, z: NonFunctionProperties) { ->f7 : Symbol(f7, Decl(conditionalTypes1.ts, 92, 39)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 94, 12)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 94, 15)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 94, 12)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 94, 20)) ->FunctionProperties : Symbol(FunctionProperties, Decl(conditionalTypes1.ts, 85, 95)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 94, 12)) ->z : Symbol(z, Decl(conditionalTypes1.ts, 94, 46)) ->NonFunctionProperties : Symbol(NonFunctionProperties, Decl(conditionalTypes1.ts, 88, 98)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 94, 12)) +>f7 : Symbol(f7, Decl(conditionalTypes1.ts, 99, 39)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 101, 12)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 101, 15)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 101, 12)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 101, 20)) +>FunctionProperties : Symbol(FunctionProperties, Decl(conditionalTypes1.ts, 92, 95)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 101, 12)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 101, 46)) +>NonFunctionProperties : Symbol(NonFunctionProperties, Decl(conditionalTypes1.ts, 95, 98)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 101, 12)) x = y; // Error ->x : Symbol(x, Decl(conditionalTypes1.ts, 94, 15)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 94, 20)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 101, 15)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 101, 20)) x = z; // Error ->x : Symbol(x, Decl(conditionalTypes1.ts, 94, 15)) ->z : Symbol(z, Decl(conditionalTypes1.ts, 94, 46)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 101, 15)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 101, 46)) y = x; ->y : Symbol(y, Decl(conditionalTypes1.ts, 94, 20)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 94, 15)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 101, 20)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 101, 15)) y = z; // Error ->y : Symbol(y, Decl(conditionalTypes1.ts, 94, 20)) ->z : Symbol(z, Decl(conditionalTypes1.ts, 94, 46)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 101, 20)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 101, 46)) z = x; ->z : Symbol(z, Decl(conditionalTypes1.ts, 94, 46)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 94, 15)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 101, 46)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 101, 15)) z = y; // Error ->z : Symbol(z, Decl(conditionalTypes1.ts, 94, 46)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 94, 20)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 101, 46)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 101, 20)) } function f8(x: keyof T, y: FunctionPropertyNames, z: NonFunctionPropertyNames) { ->f8 : Symbol(f8, Decl(conditionalTypes1.ts, 101, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 103, 12)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 103, 15)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 103, 12)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 103, 26)) ->FunctionPropertyNames : Symbol(FunctionPropertyNames, Decl(conditionalTypes1.ts, 83, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 103, 12)) ->z : Symbol(z, Decl(conditionalTypes1.ts, 103, 55)) ->NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 86, 63)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 103, 12)) +>f8 : Symbol(f8, Decl(conditionalTypes1.ts, 108, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 110, 12)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 110, 15)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 110, 12)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 110, 26)) +>FunctionPropertyNames : Symbol(FunctionPropertyNames, Decl(conditionalTypes1.ts, 90, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 110, 12)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 110, 55)) +>NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 93, 63)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 110, 12)) x = y; ->x : Symbol(x, Decl(conditionalTypes1.ts, 103, 15)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 103, 26)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 110, 15)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 110, 26)) x = z; ->x : Symbol(x, Decl(conditionalTypes1.ts, 103, 15)) ->z : Symbol(z, Decl(conditionalTypes1.ts, 103, 55)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 110, 15)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 110, 55)) y = x; // Error ->y : Symbol(y, Decl(conditionalTypes1.ts, 103, 26)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 103, 15)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 110, 26)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 110, 15)) y = z; // Error ->y : Symbol(y, Decl(conditionalTypes1.ts, 103, 26)) ->z : Symbol(z, Decl(conditionalTypes1.ts, 103, 55)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 110, 26)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 110, 55)) z = x; // Error ->z : Symbol(z, Decl(conditionalTypes1.ts, 103, 55)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 103, 15)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 110, 55)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 110, 15)) z = y; // Error ->z : Symbol(z, Decl(conditionalTypes1.ts, 103, 55)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 103, 26)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 110, 55)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 110, 26)) } type DeepReadonly = ->DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 110, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 112, 18)) +>DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 117, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 119, 18)) T extends any[] ? DeepReadonlyArray : ->T : Symbol(T, Decl(conditionalTypes1.ts, 112, 18)) ->DeepReadonlyArray : Symbol(DeepReadonlyArray, Decl(conditionalTypes1.ts, 115, 6)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 112, 18)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 119, 18)) +>DeepReadonlyArray : Symbol(DeepReadonlyArray, Decl(conditionalTypes1.ts, 122, 6)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 119, 18)) T extends object ? DeepReadonlyObject : ->T : Symbol(T, Decl(conditionalTypes1.ts, 112, 18)) ->DeepReadonlyObject : Symbol(DeepReadonlyObject, Decl(conditionalTypes1.ts, 117, 72)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 112, 18)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 119, 18)) +>DeepReadonlyObject : Symbol(DeepReadonlyObject, Decl(conditionalTypes1.ts, 124, 72)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 119, 18)) T; ->T : Symbol(T, Decl(conditionalTypes1.ts, 112, 18)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 119, 18)) interface DeepReadonlyArray extends ReadonlyArray> {} ->DeepReadonlyArray : Symbol(DeepReadonlyArray, Decl(conditionalTypes1.ts, 115, 6)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 117, 28)) +>DeepReadonlyArray : Symbol(DeepReadonlyArray, Decl(conditionalTypes1.ts, 122, 6)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 124, 28)) >ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.d.ts, --, --)) ->DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 110, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 117, 28)) +>DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 117, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 124, 28)) type DeepReadonlyObject = { ->DeepReadonlyObject : Symbol(DeepReadonlyObject, Decl(conditionalTypes1.ts, 117, 72)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 119, 24)) +>DeepReadonlyObject : Symbol(DeepReadonlyObject, Decl(conditionalTypes1.ts, 124, 72)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 126, 24)) readonly [P in NonFunctionPropertyNames]: DeepReadonly; ->P : Symbol(P, Decl(conditionalTypes1.ts, 120, 14)) ->NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 86, 63)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 119, 24)) ->DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 110, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 119, 24)) ->P : Symbol(P, Decl(conditionalTypes1.ts, 120, 14)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 127, 14)) +>NonFunctionPropertyNames : Symbol(NonFunctionPropertyNames, Decl(conditionalTypes1.ts, 93, 63)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 126, 24)) +>DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 117, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 126, 24)) +>P : Symbol(P, Decl(conditionalTypes1.ts, 127, 14)) }; function f10(part: DeepReadonly) { ->f10 : Symbol(f10, Decl(conditionalTypes1.ts, 121, 2)) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) ->DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 110, 1)) ->Part : Symbol(Part, Decl(conditionalTypes1.ts, 76, 34)) +>f10 : Symbol(f10, Decl(conditionalTypes1.ts, 128, 2)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) +>DeepReadonly : Symbol(DeepReadonly, Decl(conditionalTypes1.ts, 117, 1)) +>Part : Symbol(Part, Decl(conditionalTypes1.ts, 83, 34)) let name: string = part.name; ->name : Symbol(name, Decl(conditionalTypes1.ts, 124, 7)) +>name : Symbol(name, Decl(conditionalTypes1.ts, 131, 7)) >part.name : Symbol(name) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >name : Symbol(name) let id: number = part.subparts[0].id; ->id : Symbol(id, Decl(conditionalTypes1.ts, 125, 7)) +>id : Symbol(id, Decl(conditionalTypes1.ts, 132, 7)) >part.subparts[0].id : Symbol(id) >part.subparts : Symbol(subparts) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >subparts : Symbol(subparts) >id : Symbol(id) part.id = part.id; // Error >part.id : Symbol(id) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >id : Symbol(id) >part.id : Symbol(id) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >id : Symbol(id) part.subparts[0] = part.subparts[0]; // Error >part.subparts : Symbol(subparts) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >subparts : Symbol(subparts) >part.subparts : Symbol(subparts) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >subparts : Symbol(subparts) part.subparts[0].id = part.subparts[0].id; // Error >part.subparts[0].id : Symbol(id) >part.subparts : Symbol(subparts) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >subparts : Symbol(subparts) >id : Symbol(id) >part.subparts[0].id : Symbol(id) >part.subparts : Symbol(subparts) ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) >subparts : Symbol(subparts) >id : Symbol(id) part.updatePart("hello"); // Error ->part : Symbol(part, Decl(conditionalTypes1.ts, 123, 13)) +>part : Symbol(part, Decl(conditionalTypes1.ts, 130, 13)) } type ZeroOf = T extends number ? 0 : T extends string ? "" : false; ->ZeroOf : Symbol(ZeroOf, Decl(conditionalTypes1.ts, 130, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 132, 12)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 132, 12)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 132, 12)) +>ZeroOf : Symbol(ZeroOf, Decl(conditionalTypes1.ts, 137, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 139, 12)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 139, 12)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 139, 12)) function zeroOf(value: T) { ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 134, 16)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 134, 53)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 134, 16)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 141, 16)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 141, 53)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 141, 16)) return >(typeof value === "number" ? 0 : typeof value === "string" ? "" : false); ->ZeroOf : Symbol(ZeroOf, Decl(conditionalTypes1.ts, 130, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 134, 16)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 134, 53)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 134, 53)) +>ZeroOf : Symbol(ZeroOf, Decl(conditionalTypes1.ts, 137, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 141, 16)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 141, 53)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 141, 53)) } function f20(n: number, b: boolean, x: number | boolean, y: T) { ->f20 : Symbol(f20, Decl(conditionalTypes1.ts, 136, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 138, 13)) ->n : Symbol(n, Decl(conditionalTypes1.ts, 138, 31)) ->b : Symbol(b, Decl(conditionalTypes1.ts, 138, 41)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 138, 53)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 138, 74)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 138, 13)) +>f20 : Symbol(f20, Decl(conditionalTypes1.ts, 143, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 145, 13)) +>n : Symbol(n, Decl(conditionalTypes1.ts, 145, 31)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 145, 41)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 145, 53)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 145, 74)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 145, 13)) zeroOf(5); // 0 ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) zeroOf("hello"); // "" ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) zeroOf(true); // false ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) zeroOf(n); // 0 ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) ->n : Symbol(n, Decl(conditionalTypes1.ts, 138, 31)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) +>n : Symbol(n, Decl(conditionalTypes1.ts, 145, 31)) zeroOf(b); // False ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) ->b : Symbol(b, Decl(conditionalTypes1.ts, 138, 41)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) +>b : Symbol(b, Decl(conditionalTypes1.ts, 145, 41)) zeroOf(x); // 0 | false ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 138, 53)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 145, 53)) zeroOf(y); // ZeroOf ->zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 132, 104)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 138, 74)) +>zeroOf : Symbol(zeroOf, Decl(conditionalTypes1.ts, 139, 104)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 145, 74)) } function f21(x: T, y: ZeroOf) { ->f21 : Symbol(f21, Decl(conditionalTypes1.ts, 146, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 148, 13)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 148, 40)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 148, 13)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 148, 45)) ->ZeroOf : Symbol(ZeroOf, Decl(conditionalTypes1.ts, 130, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 148, 13)) +>f21 : Symbol(f21, Decl(conditionalTypes1.ts, 153, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 155, 13)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 155, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 155, 13)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 155, 45)) +>ZeroOf : Symbol(ZeroOf, Decl(conditionalTypes1.ts, 137, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 155, 13)) let z1: number | string = y; ->z1 : Symbol(z1, Decl(conditionalTypes1.ts, 149, 7)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 148, 45)) +>z1 : Symbol(z1, Decl(conditionalTypes1.ts, 156, 7)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 155, 45)) let z2: 0 | "" = y; ->z2 : Symbol(z2, Decl(conditionalTypes1.ts, 150, 7)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 148, 45)) +>z2 : Symbol(z2, Decl(conditionalTypes1.ts, 157, 7)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 155, 45)) x = y; // Error ->x : Symbol(x, Decl(conditionalTypes1.ts, 148, 40)) ->y : Symbol(y, Decl(conditionalTypes1.ts, 148, 45)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 155, 40)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 155, 45)) y = x; // Error ->y : Symbol(y, Decl(conditionalTypes1.ts, 148, 45)) ->x : Symbol(x, Decl(conditionalTypes1.ts, 148, 40)) +>y : Symbol(y, Decl(conditionalTypes1.ts, 155, 45)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 155, 40)) } type Extends = T extends U ? true : false; ->Extends : Symbol(Extends, Decl(conditionalTypes1.ts, 153, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 155, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 155, 15)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 155, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 155, 15)) +>Extends : Symbol(Extends, Decl(conditionalTypes1.ts, 160, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 162, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 162, 15)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 162, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 162, 15)) type If = C extends true ? T : F; ->If : Symbol(If, Decl(conditionalTypes1.ts, 155, 48)) ->C : Symbol(C, Decl(conditionalTypes1.ts, 156, 8)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 156, 26)) ->F : Symbol(F, Decl(conditionalTypes1.ts, 156, 29)) ->C : Symbol(C, Decl(conditionalTypes1.ts, 156, 8)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 156, 26)) ->F : Symbol(F, Decl(conditionalTypes1.ts, 156, 29)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 162, 48)) +>C : Symbol(C, Decl(conditionalTypes1.ts, 163, 8)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 163, 26)) +>F : Symbol(F, Decl(conditionalTypes1.ts, 163, 29)) +>C : Symbol(C, Decl(conditionalTypes1.ts, 163, 8)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 163, 26)) +>F : Symbol(F, Decl(conditionalTypes1.ts, 163, 29)) type Not = If; ->Not : Symbol(Not, Decl(conditionalTypes1.ts, 156, 58)) ->C : Symbol(C, Decl(conditionalTypes1.ts, 157, 9)) ->If : Symbol(If, Decl(conditionalTypes1.ts, 155, 48)) ->C : Symbol(C, Decl(conditionalTypes1.ts, 157, 9)) +>Not : Symbol(Not, Decl(conditionalTypes1.ts, 163, 58)) +>C : Symbol(C, Decl(conditionalTypes1.ts, 164, 9)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 162, 48)) +>C : Symbol(C, Decl(conditionalTypes1.ts, 164, 9)) type And = If; ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 158, 9)) ->B : Symbol(B, Decl(conditionalTypes1.ts, 158, 27)) ->If : Symbol(If, Decl(conditionalTypes1.ts, 155, 48)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 158, 9)) ->B : Symbol(B, Decl(conditionalTypes1.ts, 158, 27)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 165, 9)) +>B : Symbol(B, Decl(conditionalTypes1.ts, 165, 27)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 162, 48)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 165, 9)) +>B : Symbol(B, Decl(conditionalTypes1.ts, 165, 27)) type Or = If; ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 159, 8)) ->B : Symbol(B, Decl(conditionalTypes1.ts, 159, 26)) ->If : Symbol(If, Decl(conditionalTypes1.ts, 155, 48)) ->A : Symbol(A, Decl(conditionalTypes1.ts, 159, 8)) ->B : Symbol(B, Decl(conditionalTypes1.ts, 159, 26)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 166, 8)) +>B : Symbol(B, Decl(conditionalTypes1.ts, 166, 26)) +>If : Symbol(If, Decl(conditionalTypes1.ts, 162, 48)) +>A : Symbol(A, Decl(conditionalTypes1.ts, 166, 8)) +>B : Symbol(B, Decl(conditionalTypes1.ts, 166, 26)) type IsString = Extends; ->IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 159, 63)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 161, 14)) ->Extends : Symbol(Extends, Decl(conditionalTypes1.ts, 153, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 161, 14)) +>IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 166, 63)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 168, 14)) +>Extends : Symbol(Extends, Decl(conditionalTypes1.ts, 160, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 168, 14)) type Q1 = IsString; // false ->Q1 : Symbol(Q1, Decl(conditionalTypes1.ts, 161, 38)) ->IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 159, 63)) +>Q1 : Symbol(Q1, Decl(conditionalTypes1.ts, 168, 38)) +>IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 166, 63)) type Q2 = IsString<"abc">; // true ->Q2 : Symbol(Q2, Decl(conditionalTypes1.ts, 163, 27)) ->IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 159, 63)) +>Q2 : Symbol(Q2, Decl(conditionalTypes1.ts, 170, 27)) +>IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 166, 63)) type Q3 = IsString; // boolean ->Q3 : Symbol(Q3, Decl(conditionalTypes1.ts, 164, 26)) ->IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 159, 63)) +>Q3 : Symbol(Q3, Decl(conditionalTypes1.ts, 171, 26)) +>IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 166, 63)) type Q4 = IsString; // boolean ->Q4 : Symbol(Q4, Decl(conditionalTypes1.ts, 165, 24)) ->IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 159, 63)) +>Q4 : Symbol(Q4, Decl(conditionalTypes1.ts, 172, 24)) +>IsString : Symbol(IsString, Decl(conditionalTypes1.ts, 166, 63)) type N1 = Not; // true ->N1 : Symbol(N1, Decl(conditionalTypes1.ts, 166, 26)) ->Not : Symbol(Not, Decl(conditionalTypes1.ts, 156, 58)) +>N1 : Symbol(N1, Decl(conditionalTypes1.ts, 173, 26)) +>Not : Symbol(Not, Decl(conditionalTypes1.ts, 163, 58)) type N2 = Not; // false ->N2 : Symbol(N2, Decl(conditionalTypes1.ts, 168, 21)) ->Not : Symbol(Not, Decl(conditionalTypes1.ts, 156, 58)) +>N2 : Symbol(N2, Decl(conditionalTypes1.ts, 175, 21)) +>Not : Symbol(Not, Decl(conditionalTypes1.ts, 163, 58)) type N3 = Not; // boolean ->N3 : Symbol(N3, Decl(conditionalTypes1.ts, 169, 20)) ->Not : Symbol(Not, Decl(conditionalTypes1.ts, 156, 58)) +>N3 : Symbol(N3, Decl(conditionalTypes1.ts, 176, 20)) +>Not : Symbol(Not, Decl(conditionalTypes1.ts, 163, 58)) type A1 = And; // false ->A1 : Symbol(A1, Decl(conditionalTypes1.ts, 170, 23)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A1 : Symbol(A1, Decl(conditionalTypes1.ts, 177, 23)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A2 = And; // false ->A2 : Symbol(A2, Decl(conditionalTypes1.ts, 172, 28)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A2 : Symbol(A2, Decl(conditionalTypes1.ts, 179, 28)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A3 = And; // false ->A3 : Symbol(A3, Decl(conditionalTypes1.ts, 173, 27)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A3 : Symbol(A3, Decl(conditionalTypes1.ts, 180, 27)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A4 = And; // true ->A4 : Symbol(A4, Decl(conditionalTypes1.ts, 174, 27)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A4 : Symbol(A4, Decl(conditionalTypes1.ts, 181, 27)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A5 = And; // false ->A5 : Symbol(A5, Decl(conditionalTypes1.ts, 175, 26)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A5 : Symbol(A5, Decl(conditionalTypes1.ts, 182, 26)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A6 = And; // false ->A6 : Symbol(A6, Decl(conditionalTypes1.ts, 176, 30)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A6 : Symbol(A6, Decl(conditionalTypes1.ts, 183, 30)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A7 = And; // boolean ->A7 : Symbol(A7, Decl(conditionalTypes1.ts, 177, 30)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A7 : Symbol(A7, Decl(conditionalTypes1.ts, 184, 30)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A8 = And; // boolean ->A8 : Symbol(A8, Decl(conditionalTypes1.ts, 178, 29)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A8 : Symbol(A8, Decl(conditionalTypes1.ts, 185, 29)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type A9 = And; // boolean ->A9 : Symbol(A9, Decl(conditionalTypes1.ts, 179, 29)) ->And : Symbol(And, Decl(conditionalTypes1.ts, 157, 49)) +>A9 : Symbol(A9, Decl(conditionalTypes1.ts, 186, 29)) +>And : Symbol(And, Decl(conditionalTypes1.ts, 164, 49)) type O1 = Or; // false ->O1 : Symbol(O1, Decl(conditionalTypes1.ts, 180, 32)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O1 : Symbol(O1, Decl(conditionalTypes1.ts, 187, 32)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O2 = Or; // true ->O2 : Symbol(O2, Decl(conditionalTypes1.ts, 182, 27)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O2 : Symbol(O2, Decl(conditionalTypes1.ts, 189, 27)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O3 = Or; // true ->O3 : Symbol(O3, Decl(conditionalTypes1.ts, 183, 26)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O3 : Symbol(O3, Decl(conditionalTypes1.ts, 190, 26)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O4 = Or; // true ->O4 : Symbol(O4, Decl(conditionalTypes1.ts, 184, 26)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O4 : Symbol(O4, Decl(conditionalTypes1.ts, 191, 26)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O5 = Or; // boolean ->O5 : Symbol(O5, Decl(conditionalTypes1.ts, 185, 25)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O5 : Symbol(O5, Decl(conditionalTypes1.ts, 192, 25)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O6 = Or; // boolean ->O6 : Symbol(O6, Decl(conditionalTypes1.ts, 186, 29)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O6 : Symbol(O6, Decl(conditionalTypes1.ts, 193, 29)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O7 = Or; // true ->O7 : Symbol(O7, Decl(conditionalTypes1.ts, 187, 29)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O7 : Symbol(O7, Decl(conditionalTypes1.ts, 194, 29)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O8 = Or; // true ->O8 : Symbol(O8, Decl(conditionalTypes1.ts, 188, 28)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O8 : Symbol(O8, Decl(conditionalTypes1.ts, 195, 28)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type O9 = Or; // boolean ->O9 : Symbol(O9, Decl(conditionalTypes1.ts, 189, 28)) ->Or : Symbol(Or, Decl(conditionalTypes1.ts, 158, 65)) +>O9 : Symbol(O9, Decl(conditionalTypes1.ts, 196, 28)) +>Or : Symbol(Or, Decl(conditionalTypes1.ts, 165, 65)) type T40 = never extends never ? true : false; // true ->T40 : Symbol(T40, Decl(conditionalTypes1.ts, 190, 31)) +>T40 : Symbol(T40, Decl(conditionalTypes1.ts, 197, 31)) type T41 = number extends never ? true : false; // false ->T41 : Symbol(T41, Decl(conditionalTypes1.ts, 192, 46)) +>T41 : Symbol(T41, Decl(conditionalTypes1.ts, 199, 46)) type T42 = never extends number ? true : false; // boolean ->T42 : Symbol(T42, Decl(conditionalTypes1.ts, 193, 47)) +>T42 : Symbol(T42, Decl(conditionalTypes1.ts, 200, 47)) type IsNever = T extends never ? true : false; ->IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 194, 47)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 196, 13)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 196, 13)) +>IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 201, 47)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 203, 13)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 203, 13)) type T50 = IsNever; // true ->T50 : Symbol(T50, Decl(conditionalTypes1.ts, 196, 49)) ->IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 194, 47)) +>T50 : Symbol(T50, Decl(conditionalTypes1.ts, 203, 49)) +>IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 201, 47)) type T51 = IsNever; // false ->T51 : Symbol(T51, Decl(conditionalTypes1.ts, 198, 26)) ->IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 194, 47)) +>T51 : Symbol(T51, Decl(conditionalTypes1.ts, 205, 26)) +>IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 201, 47)) type T52 = IsNever; // false ->T52 : Symbol(T52, Decl(conditionalTypes1.ts, 199, 27)) ->IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 194, 47)) +>T52 : Symbol(T52, Decl(conditionalTypes1.ts, 206, 27)) +>IsNever : Symbol(IsNever, Decl(conditionalTypes1.ts, 201, 47)) // Repros from #21664 type Eq = T extends U ? U extends T ? true : false : false; ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 200, 24)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 204, 8)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 204, 10)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 204, 8)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 204, 10)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 204, 10)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 204, 8)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 207, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 211, 8)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 211, 10)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 211, 8)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 211, 10)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 211, 10)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 211, 8)) type T60 = Eq; // true ->T60 : Symbol(T60, Decl(conditionalTypes1.ts, 204, 65)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 200, 24)) +>T60 : Symbol(T60, Decl(conditionalTypes1.ts, 211, 65)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 207, 24)) type T61 = Eq; // false ->T61 : Symbol(T61, Decl(conditionalTypes1.ts, 205, 26)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 200, 24)) +>T61 : Symbol(T61, Decl(conditionalTypes1.ts, 212, 26)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 207, 24)) type T62 = Eq; // false ->T62 : Symbol(T62, Decl(conditionalTypes1.ts, 206, 27)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 200, 24)) +>T62 : Symbol(T62, Decl(conditionalTypes1.ts, 213, 27)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 207, 24)) type T63 = Eq; // true ->T63 : Symbol(T63, Decl(conditionalTypes1.ts, 207, 27)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 200, 24)) +>T63 : Symbol(T63, Decl(conditionalTypes1.ts, 214, 27)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 207, 24)) type Eq1 = Eq extends false ? false : true; ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 208, 28)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 210, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 210, 11)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 200, 24)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 210, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 210, 11)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 215, 28)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 217, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 217, 11)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 207, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 217, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 217, 11)) type T70 = Eq1; // true ->T70 : Symbol(T70, Decl(conditionalTypes1.ts, 210, 55)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 208, 28)) +>T70 : Symbol(T70, Decl(conditionalTypes1.ts, 217, 55)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 215, 28)) type T71 = Eq1; // false ->T71 : Symbol(T71, Decl(conditionalTypes1.ts, 211, 27)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 208, 28)) +>T71 : Symbol(T71, Decl(conditionalTypes1.ts, 218, 27)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 215, 28)) type T72 = Eq1; // false ->T72 : Symbol(T72, Decl(conditionalTypes1.ts, 212, 28)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 208, 28)) +>T72 : Symbol(T72, Decl(conditionalTypes1.ts, 219, 28)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 215, 28)) type T73 = Eq1; // true ->T73 : Symbol(T73, Decl(conditionalTypes1.ts, 213, 28)) ->Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 208, 28)) +>T73 : Symbol(T73, Decl(conditionalTypes1.ts, 220, 28)) +>Eq1 : Symbol(Eq1, Decl(conditionalTypes1.ts, 215, 28)) type Eq2 = Eq extends true ? true : false; ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 214, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 216, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 216, 11)) ->Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 200, 24)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 216, 9)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 216, 11)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 221, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 223, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 223, 11)) +>Eq : Symbol(Eq, Decl(conditionalTypes1.ts, 207, 24)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 223, 9)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 223, 11)) type T80 = Eq2; // true ->T80 : Symbol(T80, Decl(conditionalTypes1.ts, 216, 54)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 214, 29)) +>T80 : Symbol(T80, Decl(conditionalTypes1.ts, 223, 54)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 221, 29)) type T81 = Eq2; // false ->T81 : Symbol(T81, Decl(conditionalTypes1.ts, 217, 27)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 214, 29)) +>T81 : Symbol(T81, Decl(conditionalTypes1.ts, 224, 27)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 221, 29)) type T82 = Eq2; // false ->T82 : Symbol(T82, Decl(conditionalTypes1.ts, 218, 28)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 214, 29)) +>T82 : Symbol(T82, Decl(conditionalTypes1.ts, 225, 28)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 221, 29)) type T83 = Eq2; // true ->T83 : Symbol(T83, Decl(conditionalTypes1.ts, 219, 28)) ->Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 214, 29)) +>T83 : Symbol(T83, Decl(conditionalTypes1.ts, 226, 28)) +>Eq2 : Symbol(Eq2, Decl(conditionalTypes1.ts, 221, 29)) // Repro from #21756 type Foo = T extends string ? boolean : number; ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 220, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 224, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 224, 9)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 227, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 231, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 231, 9)) type Bar = T extends string ? boolean : number; ->Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 224, 50)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 225, 9)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 225, 9)) +>Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 231, 50)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 232, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 232, 9)) const convert = (value: Foo): Bar => value; ->convert : Symbol(convert, Decl(conditionalTypes1.ts, 226, 5)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 226, 17)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 226, 20)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 220, 29)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 226, 17)) ->Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 224, 50)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 226, 17)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 226, 20)) +>convert : Symbol(convert, Decl(conditionalTypes1.ts, 233, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 233, 17)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 233, 20)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 227, 29)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 233, 17)) +>Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 231, 50)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 233, 17)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 233, 20)) type Baz = Foo; ->Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 226, 52)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 228, 9)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 220, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 228, 9)) +>Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 233, 52)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 235, 9)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 227, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 235, 9)) const convert2 = (value: Foo): Baz => value; ->convert2 : Symbol(convert2, Decl(conditionalTypes1.ts, 229, 5)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 229, 18)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 229, 21)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 220, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 229, 18)) ->Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 226, 52)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 229, 18)) ->value : Symbol(value, Decl(conditionalTypes1.ts, 229, 21)) +>convert2 : Symbol(convert2, Decl(conditionalTypes1.ts, 236, 5)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 236, 18)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 236, 21)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 227, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 236, 18)) +>Baz : Symbol(Baz, Decl(conditionalTypes1.ts, 233, 52)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 236, 18)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 236, 21)) function f31() { ->f31 : Symbol(f31, Decl(conditionalTypes1.ts, 229, 53)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 231, 13)) +>f31 : Symbol(f31, Decl(conditionalTypes1.ts, 236, 53)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 238, 13)) type T1 = T extends string ? boolean : number; ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 231, 19)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 231, 13)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 238, 19)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 238, 13)) type T2 = T extends string ? boolean : number; ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 232, 50)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 231, 13)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 239, 50)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 238, 13)) var x: T1; ->x : Symbol(x, Decl(conditionalTypes1.ts, 234, 7), Decl(conditionalTypes1.ts, 235, 7)) ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 231, 19)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 241, 7), Decl(conditionalTypes1.ts, 242, 7)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 238, 19)) var x: T2; ->x : Symbol(x, Decl(conditionalTypes1.ts, 234, 7), Decl(conditionalTypes1.ts, 235, 7)) ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 232, 50)) +>x : Symbol(x, Decl(conditionalTypes1.ts, 241, 7), Decl(conditionalTypes1.ts, 242, 7)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 239, 50)) } function f32() { ->f32 : Symbol(f32, Decl(conditionalTypes1.ts, 236, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 238, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 238, 15)) +>f32 : Symbol(f32, Decl(conditionalTypes1.ts, 243, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 245, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 245, 15)) type T1 = T & U extends string ? boolean : number; ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 238, 22)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 238, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 238, 15)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 245, 22)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 245, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 245, 15)) type T2 = Foo; ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 239, 54)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 220, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 238, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 238, 15)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 246, 54)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 227, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 245, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 245, 15)) var z: T1; ->z : Symbol(z, Decl(conditionalTypes1.ts, 241, 7), Decl(conditionalTypes1.ts, 242, 7)) ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 238, 22)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 248, 7), Decl(conditionalTypes1.ts, 249, 7)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 245, 22)) var z: T2; // Error, T2 is distributive, T1 isn't ->z : Symbol(z, Decl(conditionalTypes1.ts, 241, 7), Decl(conditionalTypes1.ts, 242, 7)) ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 239, 54)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 248, 7), Decl(conditionalTypes1.ts, 249, 7)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 246, 54)) } function f33() { ->f33 : Symbol(f33, Decl(conditionalTypes1.ts, 243, 1)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 245, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 245, 15)) +>f33 : Symbol(f33, Decl(conditionalTypes1.ts, 250, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 252, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 252, 15)) type T1 = Foo; ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 245, 22)) ->Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 220, 29)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 245, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 245, 15)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 252, 22)) +>Foo : Symbol(Foo, Decl(conditionalTypes1.ts, 227, 29)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 252, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 252, 15)) type T2 = Bar; ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 246, 25)) ->Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 224, 50)) ->T : Symbol(T, Decl(conditionalTypes1.ts, 245, 13)) ->U : Symbol(U, Decl(conditionalTypes1.ts, 245, 15)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 253, 25)) +>Bar : Symbol(Bar, Decl(conditionalTypes1.ts, 231, 50)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 252, 13)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 252, 15)) var z: T1; ->z : Symbol(z, Decl(conditionalTypes1.ts, 248, 7), Decl(conditionalTypes1.ts, 249, 7)) ->T1 : Symbol(T1, Decl(conditionalTypes1.ts, 245, 22)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 255, 7), Decl(conditionalTypes1.ts, 256, 7)) +>T1 : Symbol(T1, Decl(conditionalTypes1.ts, 252, 22)) var z: T2; ->z : Symbol(z, Decl(conditionalTypes1.ts, 248, 7), Decl(conditionalTypes1.ts, 249, 7)) ->T2 : Symbol(T2, Decl(conditionalTypes1.ts, 246, 25)) +>z : Symbol(z, Decl(conditionalTypes1.ts, 255, 7), Decl(conditionalTypes1.ts, 256, 7)) +>T2 : Symbol(T2, Decl(conditionalTypes1.ts, 253, 25)) } +// Repro from #21823 + +type T90 = T extends 0 ? 0 : () => 0; +>T90 : Symbol(T90, Decl(conditionalTypes1.ts, 257, 1)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 261, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 261, 9)) + +type T91 = T extends 0 ? 0 : () => 0; +>T91 : Symbol(T91, Decl(conditionalTypes1.ts, 261, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 262, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 262, 9)) + +const f40 = (a: T90): T91 => a; +>f40 : Symbol(f40, Decl(conditionalTypes1.ts, 263, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 263, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 263, 16)) +>T90 : Symbol(T90, Decl(conditionalTypes1.ts, 257, 1)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 263, 13)) +>T91 : Symbol(T91, Decl(conditionalTypes1.ts, 261, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 263, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 263, 16)) + +const f41 = (a: T91): T90 => a; +>f41 : Symbol(f41, Decl(conditionalTypes1.ts, 264, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 264, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 264, 16)) +>T91 : Symbol(T91, Decl(conditionalTypes1.ts, 261, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 264, 13)) +>T90 : Symbol(T90, Decl(conditionalTypes1.ts, 257, 1)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 264, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 264, 16)) + +type T92 = T extends () => 0 ? () => 1 : () => 2; +>T92 : Symbol(T92, Decl(conditionalTypes1.ts, 264, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 266, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 266, 9)) + +type T93 = T extends () => 0 ? () => 1 : () => 2; +>T93 : Symbol(T93, Decl(conditionalTypes1.ts, 266, 52)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 267, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 267, 9)) + +const f42 = (a: T92): T93 => a; +>f42 : Symbol(f42, Decl(conditionalTypes1.ts, 268, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 268, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 268, 16)) +>T92 : Symbol(T92, Decl(conditionalTypes1.ts, 264, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 268, 13)) +>T93 : Symbol(T93, Decl(conditionalTypes1.ts, 266, 52)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 268, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 268, 16)) + +const f43 = (a: T93): T92 => a; +>f43 : Symbol(f43, Decl(conditionalTypes1.ts, 269, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 269, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 269, 16)) +>T93 : Symbol(T93, Decl(conditionalTypes1.ts, 266, 52)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 269, 13)) +>T92 : Symbol(T92, Decl(conditionalTypes1.ts, 264, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 269, 13)) +>a : Symbol(a, Decl(conditionalTypes1.ts, 269, 16)) + +type T94 = T extends string ? true : 42; +>T94 : Symbol(T94, Decl(conditionalTypes1.ts, 269, 40)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 271, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 271, 9)) + +type T95 = T extends string ? boolean : number; +>T95 : Symbol(T95, Decl(conditionalTypes1.ts, 271, 43)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 272, 9)) +>T : Symbol(T, Decl(conditionalTypes1.ts, 272, 9)) + +const f44 = (value: T94): T95 => value; +>f44 : Symbol(f44, Decl(conditionalTypes1.ts, 273, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 273, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 273, 16)) +>T94 : Symbol(T94, Decl(conditionalTypes1.ts, 269, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 273, 13)) +>T95 : Symbol(T95, Decl(conditionalTypes1.ts, 271, 43)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 273, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 273, 16)) + +const f45 = (value: T95): T94 => value; // Error +>f45 : Symbol(f45, Decl(conditionalTypes1.ts, 274, 5)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 274, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 274, 16)) +>T95 : Symbol(T95, Decl(conditionalTypes1.ts, 271, 43)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 274, 13)) +>T94 : Symbol(T94, Decl(conditionalTypes1.ts, 269, 40)) +>U : Symbol(U, Decl(conditionalTypes1.ts, 274, 13)) +>value : Symbol(value, Decl(conditionalTypes1.ts, 274, 16)) + diff --git a/tests/baselines/reference/conditionalTypes1.types b/tests/baselines/reference/conditionalTypes1.types index eb17cb31350..b915b8438d0 100644 --- a/tests/baselines/reference/conditionalTypes1.types +++ b/tests/baselines/reference/conditionalTypes1.types @@ -98,6 +98,35 @@ function f3(x: Partial[keyof T], y: NonNullable[keyof T]>) { >x : Partial[keyof T] } +function f4(x: T["x"], y: NonNullable) { +>f4 : (x: T["x"], y: NonNullable) => void +>T : T +>x : string | undefined +>x : T["x"] +>T : T +>y : NonNullable +>NonNullable : NonNullable +>T : T + + x = y; +>x = y : NonNullable +>x : T["x"] +>y : NonNullable + + y = x; // Error +>y = x : T["x"] +>y : NonNullable +>x : T["x"] + + let s1: string = x; // Error +>s1 : string +>x : T["x"] + + let s2: string = y; +>s2 : string +>y : NonNullable +} + type Options = { k: "a", a: number } | { k: "b", b: string } | { k: "c", c: boolean }; >Options : Options >k : "a" @@ -145,8 +174,8 @@ type T15 = Extract; // never >Options : Options >q : "a" -declare function f4(p: K): Extract; ->f4 : (p: K) => Extract +declare function f5(p: K): Extract; +>f5 : (p: K) => Extract >T : T >Options : Options >K : K @@ -157,10 +186,10 @@ declare function f4(p: K): Extractk : K >K : K -let x0 = f4("a"); // { k: "a", a: number } +let x0 = f5("a"); // { k: "a", a: number } >x0 : { k: "a"; a: number; } ->f4("a") : { k: "a"; a: number; } ->f4 : (p: K) => Extract +>f5("a") : { k: "a"; a: number; } +>f5 : (p: K) => Extract >"a" : "a" type OptionsOfKind = Extract; @@ -1080,3 +1109,102 @@ function f33() { >T2 : Foo } +// Repro from #21823 + +type T90 = T extends 0 ? 0 : () => 0; +>T90 : T90 +>T : T +>T : T + +type T91 = T extends 0 ? 0 : () => 0; +>T91 : T91 +>T : T +>T : T + +const f40 = (a: T90): T91 => a; +>f40 : (a: T90) => T91 +>(a: T90): T91 => a : (a: T90) => T91 +>U : U +>a : T90 +>T90 : T90 +>U : U +>T91 : T91 +>U : U +>a : T90 + +const f41 = (a: T91): T90 => a; +>f41 : (a: T91) => T90 +>(a: T91): T90 => a : (a: T91) => T90 +>U : U +>a : T91 +>T91 : T91 +>U : U +>T90 : T90 +>U : U +>a : T91 + +type T92 = T extends () => 0 ? () => 1 : () => 2; +>T92 : T92 +>T : T +>T : T + +type T93 = T extends () => 0 ? () => 1 : () => 2; +>T93 : T93 +>T : T +>T : T + +const f42 = (a: T92): T93 => a; +>f42 : (a: T92) => T93 +>(a: T92): T93 => a : (a: T92) => T93 +>U : U +>a : T92 +>T92 : T92 +>U : U +>T93 : T93 +>U : U +>a : T92 + +const f43 = (a: T93): T92 => a; +>f43 : (a: T93) => T92 +>(a: T93): T92 => a : (a: T93) => T92 +>U : U +>a : T93 +>T93 : T93 +>U : U +>T92 : T92 +>U : U +>a : T93 + +type T94 = T extends string ? true : 42; +>T94 : T94 +>T : T +>T : T +>true : true + +type T95 = T extends string ? boolean : number; +>T95 : T95 +>T : T +>T : T + +const f44 = (value: T94): T95 => value; +>f44 : (value: T94) => T95 +>(value: T94): T95 => value : (value: T94) => T95 +>U : U +>value : T94 +>T94 : T94 +>U : U +>T95 : T95 +>U : U +>value : T94 + +const f45 = (value: T95): T94 => value; // Error +>f45 : (value: T95) => T94 +>(value: T95): T94 => value : (value: T95) => T94 +>U : U +>value : T95 +>T95 : T95 +>U : U +>T94 : T94 +>U : U +>value : T95 + diff --git a/tests/cases/conformance/types/conditional/conditionalTypes1.ts b/tests/cases/conformance/types/conditional/conditionalTypes1.ts index 3a6dab9a612..10cfceb0132 100644 --- a/tests/cases/conformance/types/conditional/conditionalTypes1.ts +++ b/tests/cases/conformance/types/conditional/conditionalTypes1.ts @@ -27,6 +27,13 @@ function f3(x: Partial[keyof T], y: NonNullable[keyof T]>) { y = x; // Error } +function f4(x: T["x"], y: NonNullable) { + x = y; + y = x; // Error + let s1: string = x; // Error + let s2: string = y; +} + type Options = { k: "a", a: number } | { k: "b", b: string } | { k: "c", c: boolean }; type T10 = Exclude; // { k: "c", c: boolean } @@ -38,8 +45,8 @@ type T13 = Extract; // { k: "a", a: number } type T14 = Exclude; // Options type T15 = Extract; // never -declare function f4(p: K): Extract; -let x0 = f4("a"); // { k: "a", a: number } +declare function f5(p: K): Extract; +let x0 = f5("a"); // { k: "a", a: number } type OptionsOfKind = Extract; @@ -252,3 +259,20 @@ function f33() { var z: T1; var z: T2; } + +// Repro from #21823 + +type T90 = T extends 0 ? 0 : () => 0; +type T91 = T extends 0 ? 0 : () => 0; +const f40 = (a: T90): T91 => a; +const f41 = (a: T91): T90 => a; + +type T92 = T extends () => 0 ? () => 1 : () => 2; +type T93 = T extends () => 0 ? () => 1 : () => 2; +const f42 = (a: T92): T93 => a; +const f43 = (a: T93): T92 => a; + +type T94 = T extends string ? true : 42; +type T95 = T extends string ? boolean : number; +const f44 = (value: T94): T95 => value; +const f45 = (value: T95): T94 => value; // Error