Accept new baselines

This commit is contained in:
Anders Hejlsberg
2019-04-04 15:29:18 -07:00
parent d69aeb4af6
commit f5f1f30efd
3 changed files with 20 additions and 4 deletions
@@ -1,15 +1,18 @@
tests/cases/compiler/indexSignatureAndMappedType.ts(6,5): error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record<K, T>'.
tests/cases/compiler/indexSignatureAndMappedType.ts(15,5): error TS2322: Type 'Record<K, U>' 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<K, U>'.
==== 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<T, K extends string>(x: { [key: string]: T }, y: Record<K, T>) {
x = y;
y = x; // Error
~
!!! error TS2322: Type '{ [key: string]: T; }' is not assignable to type 'Record<K, T>'.
}
function f2<T>(x: { [key: string]: T }, y: Record<string, T>) {
@@ -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<T extends Record<string, any>, 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
@@ -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'.
}