mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 06:05:02 +03:00
80 lines
1.2 KiB
TypeScript
80 lines
1.2 KiB
TypeScript
// @strictNullChecks: true
|
|
|
|
function f1(x: string) {
|
|
if (x == undefined) {
|
|
}
|
|
if (x != undefined) {
|
|
}
|
|
if (x === undefined) {
|
|
}
|
|
if (x !== undefined) {
|
|
}
|
|
if (x == null) {
|
|
}
|
|
if (x != null) {
|
|
}
|
|
if (x === null) {
|
|
}
|
|
if (x !== null) {
|
|
}
|
|
if (undefined == x) {
|
|
}
|
|
if (undefined != x) {
|
|
}
|
|
if (undefined === x) {
|
|
}
|
|
if (undefined !== x) {
|
|
}
|
|
if (null == x) {
|
|
}
|
|
if (null != x) {
|
|
}
|
|
if (null === x) {
|
|
}
|
|
if (null !== x) {
|
|
}
|
|
}
|
|
|
|
function f2() {
|
|
if (undefined == undefined) {
|
|
}
|
|
if (undefined == null) {
|
|
}
|
|
if (null == undefined) {
|
|
}
|
|
if (null == null) {
|
|
}
|
|
}
|
|
|
|
function f3(a: number, b: boolean, c: { x: number }, d: number | string) {
|
|
if (a == null) {
|
|
}
|
|
if (b == null) {
|
|
}
|
|
if (c == null) {
|
|
}
|
|
if (d == null) {
|
|
}
|
|
}
|
|
|
|
function f4(x: number) {
|
|
if (x > undefined) {
|
|
}
|
|
if (x < undefined) {
|
|
}
|
|
if (x >= undefined) {
|
|
}
|
|
if (x <= undefined) {
|
|
}
|
|
}
|
|
function f5(x: string) {
|
|
switch(x) {
|
|
case null:
|
|
break;
|
|
case undefined:
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
}
|