Accept new baselines
This commit is contained in:
parent
59355cbfdb
commit
ce2dea98ca
4 changed files with 146 additions and 0 deletions
|
@ -0,0 +1,24 @@
|
|||
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(10,9): error TS2322: Type 'T' is not assignable to type 'object'.
|
||||
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts(11,9): error TS2322: Type 'T' is not assignable to type 'object | U'.
|
||||
Type 'T' is not assignable to type 'U'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts (2 errors) ====
|
||||
// Repros from #23800
|
||||
|
||||
type A<T, V> = { [P in keyof T]: T[P] extends V ? 1 : 0; };
|
||||
type B<T, V> = { [P in keyof T]: T[P] extends V | object ? 1 : 0; };
|
||||
|
||||
type a = A<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
type b = B<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
|
||||
function foo<T, U>(x: T) {
|
||||
let a: object = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'object'.
|
||||
let b: U | object = x; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'object | U'.
|
||||
!!! error TS2322: Type 'T' is not assignable to type 'U'.
|
||||
}
|
||||
|
22
tests/baselines/reference/nonPrimitiveAndTypeVariables.js
Normal file
22
tests/baselines/reference/nonPrimitiveAndTypeVariables.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
//// [nonPrimitiveAndTypeVariables.ts]
|
||||
// Repros from #23800
|
||||
|
||||
type A<T, V> = { [P in keyof T]: T[P] extends V ? 1 : 0; };
|
||||
type B<T, V> = { [P in keyof T]: T[P] extends V | object ? 1 : 0; };
|
||||
|
||||
type a = A<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
type b = B<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
|
||||
function foo<T, U>(x: T) {
|
||||
let a: object = x; // Error
|
||||
let b: U | object = x; // Error
|
||||
}
|
||||
|
||||
|
||||
//// [nonPrimitiveAndTypeVariables.js]
|
||||
"use strict";
|
||||
// Repros from #23800
|
||||
function foo(x) {
|
||||
var a = x; // Error
|
||||
var b = x; // Error
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts ===
|
||||
// Repros from #23800
|
||||
|
||||
type A<T, V> = { [P in keyof T]: T[P] extends V ? 1 : 0; };
|
||||
>A : Symbol(A, Decl(nonPrimitiveAndTypeVariables.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 2, 7))
|
||||
>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 2, 9))
|
||||
>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 2, 18))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 2, 7))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 2, 7))
|
||||
>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 2, 18))
|
||||
>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 2, 9))
|
||||
|
||||
type B<T, V> = { [P in keyof T]: T[P] extends V | object ? 1 : 0; };
|
||||
>B : Symbol(B, Decl(nonPrimitiveAndTypeVariables.ts, 2, 59))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 3, 7))
|
||||
>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 3, 9))
|
||||
>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 3, 18))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 3, 7))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 3, 7))
|
||||
>P : Symbol(P, Decl(nonPrimitiveAndTypeVariables.ts, 3, 18))
|
||||
>V : Symbol(V, Decl(nonPrimitiveAndTypeVariables.ts, 3, 9))
|
||||
|
||||
type a = A<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 3, 68))
|
||||
>A : Symbol(A, Decl(nonPrimitiveAndTypeVariables.ts, 0, 0))
|
||||
>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 5, 12))
|
||||
|
||||
type b = B<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
>b : Symbol(b, Decl(nonPrimitiveAndTypeVariables.ts, 5, 28))
|
||||
>B : Symbol(B, Decl(nonPrimitiveAndTypeVariables.ts, 2, 59))
|
||||
>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 6, 12))
|
||||
|
||||
function foo<T, U>(x: T) {
|
||||
>foo : Symbol(foo, Decl(nonPrimitiveAndTypeVariables.ts, 6, 28))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 8, 13))
|
||||
>U : Symbol(U, Decl(nonPrimitiveAndTypeVariables.ts, 8, 15))
|
||||
>x : Symbol(x, Decl(nonPrimitiveAndTypeVariables.ts, 8, 19))
|
||||
>T : Symbol(T, Decl(nonPrimitiveAndTypeVariables.ts, 8, 13))
|
||||
|
||||
let a: object = x; // Error
|
||||
>a : Symbol(a, Decl(nonPrimitiveAndTypeVariables.ts, 9, 7))
|
||||
>x : Symbol(x, Decl(nonPrimitiveAndTypeVariables.ts, 8, 19))
|
||||
|
||||
let b: U | object = x; // Error
|
||||
>b : Symbol(b, Decl(nonPrimitiveAndTypeVariables.ts, 10, 7))
|
||||
>U : Symbol(U, Decl(nonPrimitiveAndTypeVariables.ts, 8, 15))
|
||||
>x : Symbol(x, Decl(nonPrimitiveAndTypeVariables.ts, 8, 19))
|
||||
}
|
||||
|
50
tests/baselines/reference/nonPrimitiveAndTypeVariables.types
Normal file
50
tests/baselines/reference/nonPrimitiveAndTypeVariables.types
Normal file
|
@ -0,0 +1,50 @@
|
|||
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndTypeVariables.ts ===
|
||||
// Repros from #23800
|
||||
|
||||
type A<T, V> = { [P in keyof T]: T[P] extends V ? 1 : 0; };
|
||||
>A : A<T, V>
|
||||
>T : T
|
||||
>V : V
|
||||
>P : P
|
||||
>T : T
|
||||
>T : T
|
||||
>P : P
|
||||
>V : V
|
||||
|
||||
type B<T, V> = { [P in keyof T]: T[P] extends V | object ? 1 : 0; };
|
||||
>B : B<T, V>
|
||||
>T : T
|
||||
>V : V
|
||||
>P : P
|
||||
>T : T
|
||||
>T : T
|
||||
>P : P
|
||||
>V : V
|
||||
|
||||
type a = A<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
>a : A<{ a: 0 | 1; }, 0>
|
||||
>A : A<T, V>
|
||||
>a : 0 | 1
|
||||
|
||||
type b = B<{ a: 0 | 1 }, 0>; // { a: 0; }
|
||||
>b : B<{ a: 0 | 1; }, 0>
|
||||
>B : B<T, V>
|
||||
>a : 0 | 1
|
||||
|
||||
function foo<T, U>(x: T) {
|
||||
>foo : <T, U>(x: T) => void
|
||||
>T : T
|
||||
>U : U
|
||||
>x : T
|
||||
>T : T
|
||||
|
||||
let a: object = x; // Error
|
||||
>a : object
|
||||
>x : T
|
||||
|
||||
let b: U | object = x; // Error
|
||||
>b : object | U
|
||||
>U : U
|
||||
>x : T
|
||||
}
|
||||
|
Loading…
Reference in a new issue