mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add regression test
This commit is contained in:
@@ -46,4 +46,9 @@ tests/cases/compiler/intersectionsAndOptionalProperties.ts(20,5): error TS2322:
|
||||
~~~~~~~
|
||||
!!! error TS2322: Type 'null' is not assignable to type 'number | undefined'.
|
||||
}
|
||||
|
||||
// Repro from #38348
|
||||
|
||||
const yy: number[] & [number, ...number[]] = [1];
|
||||
const xx: [number, ...number[]] = yy;
|
||||
|
||||
@@ -20,6 +20,11 @@ function foo(v: From) {
|
||||
x = v; // Error
|
||||
x.field = v.field; // Error
|
||||
}
|
||||
|
||||
// Repro from #38348
|
||||
|
||||
const yy: number[] & [number, ...number[]] = [1];
|
||||
const xx: [number, ...number[]] = yy;
|
||||
|
||||
|
||||
//// [intersectionsAndOptionalProperties.js]
|
||||
@@ -31,3 +36,6 @@ function foo(v) {
|
||||
x = v; // Error
|
||||
x.field = v.field; // Error
|
||||
}
|
||||
// Repro from #38348
|
||||
var yy = [1];
|
||||
var xx = yy;
|
||||
|
||||
@@ -62,3 +62,12 @@ function foo(v: From) {
|
||||
>field : Symbol(field, Decl(intersectionsAndOptionalProperties.ts, 14, 14))
|
||||
}
|
||||
|
||||
// Repro from #38348
|
||||
|
||||
const yy: number[] & [number, ...number[]] = [1];
|
||||
>yy : Symbol(yy, Decl(intersectionsAndOptionalProperties.ts, 24, 5))
|
||||
|
||||
const xx: [number, ...number[]] = yy;
|
||||
>xx : Symbol(xx, Decl(intersectionsAndOptionalProperties.ts, 25, 5))
|
||||
>yy : Symbol(yy, Decl(intersectionsAndOptionalProperties.ts, 24, 5))
|
||||
|
||||
|
||||
@@ -63,3 +63,14 @@ function foo(v: From) {
|
||||
>field : null
|
||||
}
|
||||
|
||||
// Repro from #38348
|
||||
|
||||
const yy: number[] & [number, ...number[]] = [1];
|
||||
>yy : number[] & [number, ...number[]]
|
||||
>[1] : [number]
|
||||
>1 : 1
|
||||
|
||||
const xx: [number, ...number[]] = yy;
|
||||
>xx : [number, ...number[]]
|
||||
>yy : number[] & [number, ...number[]]
|
||||
|
||||
|
||||
@@ -21,3 +21,8 @@ function foo(v: From) {
|
||||
x = v; // Error
|
||||
x.field = v.field; // Error
|
||||
}
|
||||
|
||||
// Repro from #38348
|
||||
|
||||
const yy: number[] & [number, ...number[]] = [1];
|
||||
const xx: [number, ...number[]] = yy;
|
||||
|
||||
Reference in New Issue
Block a user