From f5f1f30efdfb1dae848227fcd78855952484b913 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 4 Apr 2019 15:29:18 -0700 Subject: [PATCH] Accept new baselines --- .../indexSignatureAndMappedType.errors.txt | 5 ++++- .../keyofAndIndexedAccessErrors.errors.txt | 17 ++++++++++++++++- ...mitiveConstraintOfIndexAccessType.errors.txt | 2 -- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/indexSignatureAndMappedType.errors.txt b/tests/baselines/reference/indexSignatureAndMappedType.errors.txt index 9fbf139a172..623fcd11bd0 100644 --- a/tests/baselines/reference/indexSignatureAndMappedType.errors.txt +++ b/tests/baselines/reference/indexSignatureAndMappedType.errors.txt @@ -1,15 +1,18 @@ +tests/cases/compiler/indexSignatureAndMappedType.ts(6,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. tests/cases/compiler/indexSignatureAndMappedType.ts(15,5): error TS2322: Type 'Record' is not assignable to type '{ [key: string]: T; }'. Type 'U' is not assignable to type 'T'. tests/cases/compiler/indexSignatureAndMappedType.ts(16,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. -==== tests/cases/compiler/indexSignatureAndMappedType.ts (2 errors) ==== +==== tests/cases/compiler/indexSignatureAndMappedType.ts (3 errors) ==== // A mapped type { [P in K]: X }, where K is a generic type, is related to // { [key: string]: Y } if X is related to Y. function f1(x: { [key: string]: T }, y: Record) { x = y; y = x; // Error + ~ +!!! error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record'. } function f2(x: { [key: string]: T }, y: Record) { diff --git a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt index 3edb277c02b..02f166b827e 100644 --- a/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt +++ b/tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt @@ -63,9 +63,15 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error Type 'T' is not assignable to type 'U'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(122,5): error TS2322: Type '42' is not assignable to type 'keyof T'. tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error TS2322: Type '"hello"' is not assignable to type 'keyof T'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(140,5): error TS2322: Type '42' is not assignable to type 'T[K]'. + Type '42' is not assignable to type 'T[string]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(141,5): error TS2322: Type '"hello"' is not assignable to type 'T[K]'. + Type '"hello"' is not assignable to type 'T[string]'. +tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error TS2322: Type 'number[]' is not assignable to type 'T[K]'. + Type 'number[]' is not assignable to type 'T[string]'. -==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (38 errors) ==== +==== tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts (41 errors) ==== class Shape { name: string; width: number; @@ -309,8 +315,17 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(123,5): error function test1, K extends keyof T>(t: T, k: K) { t[k] = 42; // Error + ~~~~ +!!! error TS2322: Type '42' is not assignable to type 'T[K]'. +!!! error TS2322: Type '42' is not assignable to type 'T[string]'. t[k] = "hello"; // Error + ~~~~ +!!! error TS2322: Type '"hello"' is not assignable to type 'T[K]'. +!!! error TS2322: Type '"hello"' is not assignable to type 'T[string]'. t[k] = [10, 20]; // Error + ~~~~ +!!! error TS2322: Type 'number[]' is not assignable to type 'T[K]'. +!!! error TS2322: Type 'number[]' is not assignable to type 'T[string]'. } // Repro from #28839 diff --git a/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt b/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt index a69a3d29b45..afb588941d9 100644 --- a/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt +++ b/tests/baselines/reference/nonPrimitiveConstraintOfIndexAccessType.errors.txt @@ -17,7 +17,6 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy 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 'T[string] & T[number]'. Type 'string' is not assignable to type 'T[string]'. - Type 'string' is not assignable to type 'number'. ==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts (10 errors) ==== @@ -80,6 +79,5 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy !!! error TS2322: Type 'string' is not assignable to type 'T[P]'. !!! error TS2322: Type 'string' is not assignable to type 'T[string] & T[number]'. !!! error TS2322: Type 'string' is not assignable to type 'T[string]'. -!!! error TS2322: Type 'string' is not assignable to type 'number'. } \ No newline at end of file