mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add tests
This commit is contained in:
@@ -37,6 +37,14 @@ function f01(x: unknown) {
|
||||
assertDefined(x);
|
||||
x; // string
|
||||
}
|
||||
if (!!true) {
|
||||
assert(false);
|
||||
x; // Unreachable
|
||||
}
|
||||
if (!!true) {
|
||||
assert(false && x === undefined);
|
||||
x; // Unreachable
|
||||
}
|
||||
}
|
||||
|
||||
function f02(x: string | undefined) {
|
||||
@@ -77,6 +85,10 @@ function f10(x: string | undefined) {
|
||||
Debug.assertDefined(x);
|
||||
x.length;
|
||||
}
|
||||
if (!!true) {
|
||||
Debug.assert(false);
|
||||
x; // Unreachable
|
||||
}
|
||||
}
|
||||
|
||||
class Test {
|
||||
@@ -108,6 +120,10 @@ class Test {
|
||||
this.assertIsTest2();
|
||||
this.z;
|
||||
}
|
||||
baz(x: number) {
|
||||
this.assert(false);
|
||||
x; // Unreachable
|
||||
}
|
||||
}
|
||||
|
||||
class Test2 extends Test {
|
||||
|
||||
Reference in New Issue
Block a user