mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-15 00:06:16 -06:00
Added tests.
This commit is contained in:
parent
b0100100a1
commit
60e7b5d17e
19
tests/cases/compiler/omitTypeTestErrors01.ts
Normal file
19
tests/cases/compiler/omitTypeTestErrors01.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// @declaration: true
|
||||
|
||||
interface Foo {
|
||||
a: string;
|
||||
b: number;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
export type Bar = Omit<Foo, "c">;
|
||||
export type Baz = Omit<Foo, "b" | "c">;
|
||||
|
||||
export function getBarC(bar: Bar) {
|
||||
return bar.c;
|
||||
}
|
||||
|
||||
export function getBazB(baz: Baz) {
|
||||
return baz.b;
|
||||
}
|
||||
|
||||
19
tests/cases/compiler/omitTypeTests01.ts
Normal file
19
tests/cases/compiler/omitTypeTests01.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// @declaration: true
|
||||
|
||||
interface Foo {
|
||||
a: string;
|
||||
b: number;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
export type Bar = Omit<Foo, "c">;
|
||||
export type Baz = Omit<Foo, "b" | "c">;
|
||||
|
||||
export function getBarA(bar: Bar) {
|
||||
return bar.a;
|
||||
}
|
||||
|
||||
export function getBazA(baz: Baz) {
|
||||
return baz.a;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user