mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:55:10 -05:00
Accept new baselines
This commit is contained in:
@@ -11,25 +11,16 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(18,5): error TS232
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(19,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type 'T'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(26,7): error TS2339: Property 'x' does not exist on type 'T'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(27,5): error TS2322: Type '1' is not assignable to type 'T[keyof T]'.
|
||||
Type '1' is not assignable to type 'T[string] & T[number]'.
|
||||
Type '1' is not assignable to type 'T[string]'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(31,5): error TS2322: Type '{ [key: string]: number; }' is not assignable to type '{ [P in K]: number; }'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(45,3): error TS7017: Element implicitly has an 'any' type because type 'Item' has no index signature.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(46,3): error TS2322: Type '123' is not assignable to type 'string & number'.
|
||||
Type '123' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(47,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
|
||||
Type '123' is not assignable to type 'T["a"] & T["b"]'.
|
||||
Type '123' is not assignable to type 'T["a"]'.
|
||||
Type '123' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(48,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
|
||||
Type '123' is not assignable to type 'T["a"] & T["b"]'.
|
||||
Type '123' is not assignable to type 'T["a"]'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(60,7): error TS2339: Property 'foo' does not exist on type 'T'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(61,3): error TS2536: Type 'string' cannot be used to index type 'T'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(62,3): error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
|
||||
Type '123' is not assignable to type 'T[string]'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(63,3): error TS2322: Type '123' is not assignable to type 'T[K]'.
|
||||
Type '123' is not assignable to type 'T[string]'.
|
||||
tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS2322: Type '123' is not assignable to type 'Type[K]'.
|
||||
Type '123' is not assignable to type '123 & "some string"'.
|
||||
Type '123' is not assignable to type '"some string"'.
|
||||
@@ -88,8 +79,6 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS23
|
||||
c[k] = 1; // Error, cannot write to index signature through constraint
|
||||
~~~~
|
||||
!!! error TS2322: Type '1' is not assignable to type 'T[keyof T]'.
|
||||
!!! error TS2322: Type '1' is not assignable to type 'T[string] & T[number]'.
|
||||
!!! error TS2322: Type '1' is not assignable to type 'T[string]'.
|
||||
}
|
||||
|
||||
function f3<K extends string>(a: { [P in K]: number }, b: { [key: string]: number }, k: K) {
|
||||
@@ -119,14 +108,9 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS23
|
||||
obj[k3] = 123; // Error
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T["a"] & T["b"]'.
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T["a"]'.
|
||||
!!! error TS2322: Type '123' is not assignable to type 'string'.
|
||||
obj[k4] = 123; // Error
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T[K]'.
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T["a"] & T["b"]'.
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T["a"]'.
|
||||
}
|
||||
|
||||
type Dict = Record<string, number>;
|
||||
@@ -147,11 +131,9 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccess2.ts(103,5): error TS23
|
||||
obj[k2] = 123; // Error
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T[keyof T]'.
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T[string]'.
|
||||
obj[k3] = 123; // Error
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T[K]'.
|
||||
!!! error TS2322: Type '123' is not assignable to type 'T[string]'.
|
||||
}
|
||||
|
||||
// Repro from #27895
|
||||
|
||||
@@ -64,11 +64,8 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(117,5): error
|
||||
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 (41 errors) ====
|
||||
@@ -317,15 +314,12 @@ tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts(142,5): error
|
||||
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
|
||||
|
||||
@@ -3,20 +3,12 @@ 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]'.
|
||||
Type 'string' is not assignable to type 'T["toString"] & T["toFixed"] & T["toExponential"] & T["toPrecision"] & T["valueOf"] & T["toLocaleString"]'.
|
||||
Type 'string' is not assignable to type 'T["toString"]'.
|
||||
Type 'string' is not assignable to type '(radix?: number | undefined) => string'.
|
||||
tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts(21,5): error TS2322: Type 'string' is not assignable to type 'T[P]'.
|
||||
Type 'string' is not assignable to type 'T[number] & T["toString"] & T["valueOf"] & T["charAt"] & T["charCodeAt"] & T["concat"] & T["indexOf"] & T["lastIndexOf"] & T["localeCompare"] & T["match"] & T["replace"] & T["search"] & T["slice"] & T["split"] & T["substring"] & T["toLowerCase"] & T["toLocaleLowerCase"] & T["toUpperCase"] & T["toLocaleUpperCase"] & T["trim"] & T["length"] & T["substr"]'.
|
||||
Type 'string' is not assignable to type 'T[number]'.
|
||||
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]'.
|
||||
Type 'string' is not assignable to type 'T["a"]'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
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]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts (10 errors) ====
|
||||
@@ -45,21 +37,17 @@ 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<T extends number, P extends keyof T>(s: string, tp: T[P]): void {
|
||||
tp = s;
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T["toString"] & T["toFixed"] & T["toExponential"] & T["toPrecision"] & T["valueOf"] & T["toLocaleString"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T["toString"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '(radix?: number | undefined) => string'.
|
||||
}
|
||||
function o<T extends string, P extends keyof T>(s: string, tp: T[P]): void {
|
||||
tp = s;
|
||||
~~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[P]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[number] & T["toString"] & T["valueOf"] & T["charAt"] & T["charCodeAt"] & T["concat"] & T["indexOf"] & T["lastIndexOf"] & T["localeCompare"] & T["match"] & T["replace"] & T["search"] & T["slice"] & T["split"] & T["substring"] & T["toLowerCase"] & T["toLocaleLowerCase"] & T["toUpperCase"] & T["toLocaleUpperCase"] & T["trim"] & T["length"] & T["substr"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'T[number]'.
|
||||
}
|
||||
function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void {
|
||||
tp = s;
|
||||
@@ -70,14 +58,10 @@ 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 'T["a"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
}
|
||||
function n<T extends { [s: string]: number }, P extends keyof T>(s: string, tp: T[P]): void {
|
||||
tp = s;
|
||||
~~
|
||||
!!! 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]'.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user