mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accept new baselines
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
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 (3 errors) ====
|
||||
==== tests/cases/compiler/indexSignatureAndMappedType.ts (2 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>) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
tests/cases/compiler/infiniteConstraints.ts(3,37): error TS2589: Type instantiation is excessively deep and possibly infinite.
|
||||
tests/cases/compiler/infiniteConstraints.ts(4,37): error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.
|
||||
tests/cases/compiler/infiniteConstraints.ts(21,21): error TS2536: Type '"val"' cannot be used to index type 'Extract<T[K], Record<"val", string>>'.
|
||||
tests/cases/compiler/infiniteConstraints.ts(21,57): error TS2536: Type '"val"' cannot be used to index type 'Extract<T[Exclude<keyof T, K>], Record<"val", string>>'.
|
||||
@@ -7,12 +6,10 @@ tests/cases/compiler/infiniteConstraints.ts(31,63): error TS2322: Type 'Record<"
|
||||
tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/infiniteConstraints.ts (7 errors) ====
|
||||
==== tests/cases/compiler/infiniteConstraints.ts (6 errors) ====
|
||||
// Both of the following types trigger the recursion limiter in getImmediateBaseConstraint
|
||||
|
||||
type T1<B extends { [K in keyof B]: Extract<B[Exclude<keyof B, K>], { val: string }>["val"] }> = B;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2589: Type instantiation is excessively deep and possibly infinite.
|
||||
type T2<B extends { [K in keyof B]: B[Exclude<keyof B, K>]["val"] }> = B;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(9,30): error TS2536: Type 'K' cannot be used to index type 'T1<K>'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(13,30): error TS2536: Type 'K' cannot be used to index type 'T3'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,38): error TS2536: Type 'S' cannot be used to index type '{ [key in AB[S]]: true; }'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,47): error TS2322: Type 'AB[S]' is not assignable to type 'string | number | symbol'.
|
||||
Type 'AB[S]' is not assignable to type 'symbol'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(15,47): error TS2536: Type 'S' cannot be used to index type 'AB'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(17,49): error TS2536: Type 'L' cannot be used to index type '{ [key in AB[S]]: true; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/mapped/mappedTypeErrors2.ts (5 errors) ====
|
||||
==== tests/cases/conformance/types/mapped/mappedTypeErrors2.ts (6 errors) ====
|
||||
// Repros from #17238
|
||||
|
||||
type AB = {
|
||||
@@ -26,6 +27,8 @@ tests/cases/conformance/types/mapped/mappedTypeErrors2.ts(17,49): error TS2536:
|
||||
!!! error TS2536: Type 'K' cannot be used to index type 'T3'.
|
||||
|
||||
type T5<S extends 'a'|'b'|'extra'> = {[key in AB[S]]: true}[S]; // Error
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2536: Type 'S' cannot be used to index type '{ [key in AB[S]]: true; }'.
|
||||
~~~~~
|
||||
!!! error TS2322: Type 'AB[S]' is not assignable to type 'string | number | symbol'.
|
||||
!!! error TS2322: Type 'AB[S]' is not assignable to type 'symbol'.
|
||||
|
||||
@@ -13,13 +13,24 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(35,5): error TS2
|
||||
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(40,5): error TS2322: Type 'U[keyof T] | undefined' is not assignable to type 'T[keyof T]'.
|
||||
Type 'undefined' is not assignable to type 'T[keyof T]'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(41,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
|
||||
Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[keyof T] | undefined'.
|
||||
Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
|
||||
Type 'T[string]' is not assignable to type 'U[keyof T]'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(45,5): error TS2322: Type 'U[K] | undefined' is not assignable to type 'T[K]'.
|
||||
Type 'undefined' is not assignable to type 'T[K]'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(46,5): error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
|
||||
Type 'T[K]' is not assignable to type 'U[K]'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
Type 'T[keyof T]' is not assignable to type 'U[K] | undefined'.
|
||||
Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[K] | undefined'.
|
||||
Type 'T[string]' is not assignable to type 'U[K] | undefined'.
|
||||
Type 'T[string]' is not assignable to type 'U[K]'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
Type 'T[keyof T]' is not assignable to type 'U[K]'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
Type 'T[K]' is not assignable to type 'U[K]'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(51,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
|
||||
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(56,5): error TS2542: Index signature in type 'Readonly<T>' only permits reading.
|
||||
tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(61,5): error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
|
||||
@@ -123,8 +134,12 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
|
||||
y[k] = x[k]; // Error
|
||||
~~~~
|
||||
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T] | undefined'.
|
||||
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[keyof T] | undefined'.
|
||||
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T] | undefined'.
|
||||
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[keyof T]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[keyof T]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
}
|
||||
|
||||
function f13<T, U extends T, K extends keyof T>(x: T, y: Partial<U>, k: K) {
|
||||
@@ -135,8 +150,15 @@ tests/cases/conformance/types/mapped/mappedTypeRelationships.ts(168,5): error TS
|
||||
y[k] = x[k]; // Error
|
||||
~~~~
|
||||
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K] | undefined'.
|
||||
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[K] | undefined'.
|
||||
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'U[K] | undefined'.
|
||||
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K] | undefined'.
|
||||
!!! error TS2322: Type 'T[string]' is not assignable to type 'U[K]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'U[K]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
!!! error TS2322: Type 'T[K]' is not assignable to type 'U[K]'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
}
|
||||
|
||||
function f20<T>(x: T, y: Readonly<T>, k: keyof T) {
|
||||
|
||||
@@ -3,6 +3,9 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(24,5): error TS2322: Type '
|
||||
tests/cases/conformance/types/mapped/mappedTypes6.ts(27,5): error TS2322: Type 'Partial<T>' is not assignable to type 'T'.
|
||||
tests/cases/conformance/types/mapped/mappedTypes6.ts(37,5): error TS2322: Type 'Required<T>' is not assignable to type 'Denullified<T>'.
|
||||
Type 'T[P]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
Type 'T[keyof T]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
Type 'T[string]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
tests/cases/conformance/types/mapped/mappedTypes6.ts(38,5): error TS2322: Type 'T' is not assignable to type 'Denullified<T>'.
|
||||
tests/cases/conformance/types/mapped/mappedTypes6.ts(39,5): error TS2322: Type 'Partial<T>' is not assignable to type 'Denullified<T>'.
|
||||
tests/cases/conformance/types/mapped/mappedTypes6.ts(42,5): error TS2322: Type 'T' is not assignable to type 'Required<T>'.
|
||||
@@ -67,6 +70,9 @@ tests/cases/conformance/types/mapped/mappedTypes6.ts(120,4): error TS2540: Canno
|
||||
~
|
||||
!!! error TS2322: Type 'Required<T>' is not assignable to type 'Denullified<T>'.
|
||||
!!! error TS2322: Type 'T[P]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
!!! error TS2322: Type 'T[keyof T]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
!!! error TS2322: Type 'T[string]' is not assignable to type 'NonNullable<T[P]>'.
|
||||
w = y; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'Denullified<T>'.
|
||||
|
||||
@@ -9,8 +9,7 @@ tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessTy
|
||||
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["toString"]'.
|
||||
Type 'string' is not assignable to type '() => string'.
|
||||
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"]'.
|
||||
@@ -61,8 +60,7 @@ 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[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["toString"]'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type '() => string'.
|
||||
!!! 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;
|
||||
|
||||
Reference in New Issue
Block a user