mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:55:10 -05:00
Added tests.
This commit is contained in:
24
tests/cases/compiler/errorMessagesIntersectionTypes03.ts
Normal file
24
tests/cases/compiler/errorMessagesIntersectionTypes03.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
interface A {
|
||||
a;
|
||||
}
|
||||
|
||||
interface B {
|
||||
b;
|
||||
}
|
||||
|
||||
function f<T, U extends A, V extends U>(): void {
|
||||
let t: T;
|
||||
let u: U;
|
||||
let v: V;
|
||||
|
||||
let a_and_b: A & B;
|
||||
let t_and_b: T & B;
|
||||
|
||||
t = a_and_b;
|
||||
u = a_and_b;
|
||||
v = a_and_b;
|
||||
|
||||
t = t_and_b;
|
||||
u = t_and_b;
|
||||
v = t_and_b;
|
||||
}
|
||||
22
tests/cases/compiler/errorMessagesIntersectionTypes04.ts
Normal file
22
tests/cases/compiler/errorMessagesIntersectionTypes04.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
interface A {
|
||||
a;
|
||||
}
|
||||
|
||||
interface B {
|
||||
b;
|
||||
}
|
||||
|
||||
function f<T, U extends A, V extends U>(): void {
|
||||
let num: number;
|
||||
let bool: boolean;
|
||||
let str: string;
|
||||
|
||||
let a_and_b: A & B;
|
||||
let num_and_bool: number & boolean;
|
||||
|
||||
num = a_and_b;
|
||||
bool = a_and_b;
|
||||
str = a_and_b;
|
||||
|
||||
str = num_and_bool;
|
||||
}
|
||||
Reference in New Issue
Block a user