diff --git a/tests/baselines/reference/infiniteConstraints.errors.txt b/tests/baselines/reference/infiniteConstraints.errors.txt index 36b77b2b3f..685b18932c 100644 --- a/tests/baselines/reference/infiniteConstraints.errors.txt +++ b/tests/baselines/reference/infiniteConstraints.errors.txt @@ -1,19 +1,10 @@ -error TS2321: Excessive stack depth comparing types 'Extract], Record<"val", string>>["val"]' and 'Extract>], Record<"val", string>>["val"]'. -error TS2321: Excessive stack depth comparing types 'Extract], Record<"val", string>>["val"]' and 'Extract>], Record<"val", string>>["val"]'. -error TS2321: Excessive stack depth comparing types 'Extract], Record<"val", string>>["val"]' and 'Extract>], Record<"val", string>>["val"]'. tests/cases/compiler/infiniteConstraints.ts(4,37): error TS2536: Type '"val"' cannot be used to index type 'B[Exclude]'. -tests/cases/compiler/infiniteConstraints.ts(27,37): error TS2322: Type 'Record<"val", "test">' is not assignable to type 'never'. -tests/cases/compiler/infiniteConstraints.ts(27,58): error TS2322: Type 'Record<"val", "test2">' is not assignable to type 'never'. -tests/cases/compiler/infiniteConstraints.ts(29,45): error TS2322: Type 'Record<"val", "test">' is not assignable to type 'never'. tests/cases/compiler/infiniteConstraints.ts(31,43): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'. tests/cases/compiler/infiniteConstraints.ts(31,63): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'. tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'. -!!! error TS2321: Excessive stack depth comparing types 'Extract], Record<"val", string>>["val"]' and 'Extract>], Record<"val", string>>["val"]'. -!!! error TS2321: Excessive stack depth comparing types 'Extract], Record<"val", string>>["val"]' and 'Extract>], Record<"val", string>>["val"]'. -!!! error TS2321: Excessive stack depth comparing types 'Extract], Record<"val", string>>["val"]' and 'Extract>], Record<"val", string>>["val"]'. -==== tests/cases/compiler/infiniteConstraints.ts (7 errors) ==== +==== tests/cases/compiler/infiniteConstraints.ts (4 errors) ==== // Both of the following types trigger the recursion limiter in getImmediateBaseConstraint type T1], { val: string }>["val"] }> = B; @@ -43,17 +34,8 @@ tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' c >(vals: T): void; const noError = ensureNoDuplicates({main: value("test"), alternate: value("test2")}); - ~~~~ -!!! error TS2322: Type 'Record<"val", "test">' is not assignable to type 'never'. -!!! related TS6500 tests/cases/compiler/infiniteConstraints.ts:27:37: The expected type comes from property 'main' which is declared here on type '{ main: never; alternate: never; }' - ~~~~~~~~~ -!!! error TS2322: Type 'Record<"val", "test2">' is not assignable to type 'never'. -!!! related TS6500 tests/cases/compiler/infiniteConstraints.ts:27:58: The expected type comes from property 'alternate' which is declared here on type '{ main: never; alternate: never; }' const shouldBeNoError = ensureNoDuplicates({main: value("test")}); - ~~~~ -!!! error TS2322: Type 'Record<"val", "test">' is not assignable to type 'never'. -!!! related TS6500 tests/cases/compiler/infiniteConstraints.ts:29:45: The expected type comes from property 'main' which is declared here on type '{ main: never; }' const shouldBeError = ensureNoDuplicates({main: value("dup"), alternate: value("dup")}); ~~~~ diff --git a/tests/baselines/reference/infiniteConstraints.types b/tests/baselines/reference/infiniteConstraints.types index 7e357fbb01..e23e138c82 100644 --- a/tests/baselines/reference/infiniteConstraints.types +++ b/tests/baselines/reference/infiniteConstraints.types @@ -39,7 +39,7 @@ declare function value(val: V): Value; >val : V declare function ensureNoDuplicates< ->ensureNoDuplicates : (vals: T) => void +>ensureNoDuplicates : >["val"] extends Extract], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void T extends { [K in keyof T]: Extract["val"] extends Extract], Value>["val"] @@ -50,9 +50,9 @@ declare function ensureNoDuplicates< >vals : T const noError = ensureNoDuplicates({main: value("test"), alternate: value("test2")}); ->noError : any ->ensureNoDuplicates({main: value("test"), alternate: value("test2")}) : any ->ensureNoDuplicates : (vals: T) => void +>noError : void +>ensureNoDuplicates({main: value("test"), alternate: value("test2")}) : void +>ensureNoDuplicates : >["val"] extends Extract], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void >{main: value("test"), alternate: value("test2")} : { main: Record<"val", "test">; alternate: Record<"val", "test2">; } >main : Record<"val", "test"> >value("test") : Record<"val", "test"> @@ -64,9 +64,9 @@ const noError = ensureNoDuplicates({main: value("test"), alternate: value("test2 >"test2" : "test2" const shouldBeNoError = ensureNoDuplicates({main: value("test")}); ->shouldBeNoError : any ->ensureNoDuplicates({main: value("test")}) : any ->ensureNoDuplicates : (vals: T) => void +>shouldBeNoError : void +>ensureNoDuplicates({main: value("test")}) : void +>ensureNoDuplicates : >["val"] extends Extract], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void >{main: value("test")} : { main: Record<"val", "test">; } >main : Record<"val", "test"> >value("test") : Record<"val", "test"> @@ -76,7 +76,7 @@ const shouldBeNoError = ensureNoDuplicates({main: value("test")}); const shouldBeError = ensureNoDuplicates({main: value("dup"), alternate: value("dup")}); >shouldBeError : any >ensureNoDuplicates({main: value("dup"), alternate: value("dup")}) : any ->ensureNoDuplicates : (vals: T) => void +>ensureNoDuplicates : >["val"] extends Extract], Record<"val", string>>["val"] ? never : any; }>(vals: T) => void >{main: value("dup"), alternate: value("dup")} : { main: Record<"val", "dup">; alternate: Record<"val", "dup">; } >main : Record<"val", "dup"> >value("dup") : Record<"val", "dup"> diff --git a/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt b/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt index 5784d8c46d..e63f360e24 100644 --- a/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt +++ b/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt @@ -3,13 +3,11 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(9,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(12,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(15,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. - Type 'string' is not assignable to type 'never'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(18,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(24,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(27,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(30,5): error TS2322: Type 'string' is not assignable to type 'T[P]'. - Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts (10 errors) ==== @@ -38,7 +36,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy tp = s; ~~ !!! error TS2322: Type 'string' is not assignable to type 'T[P]'. -!!! error TS2322: Type 'string' is not assignable to type 'never'. } function k(s: string, tp: T[P]): void { tp = s; @@ -64,6 +61,5 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy tp = s; ~~ !!! error TS2322: Type 'string' is not assignable to type 'T[P]'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.errors.txt b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.errors.txt new file mode 100644 index 0000000000..dec048bb87 --- /dev/null +++ b/tests/baselines/reference/undefinedAssignableToGenericMappedIntersection.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts(5,5): error TS2322: Type 'undefined' is not assignable to type 'Errors[keyof T]'. + + +==== tests/cases/compiler/undefinedAssignableToGenericMappedIntersection.ts (1 errors) ==== + type Errors = { [P in keyof T]: string | undefined } & {all: string | undefined}; + function foo() { + let obj!: Errors + let x!: keyof T; + obj[x] = undefined; + ~~~~~~ +!!! error TS2322: Type 'undefined' is not assignable to type 'Errors[keyof T]'. + } + \ No newline at end of file