mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
93 lines
2.3 KiB
Plaintext
93 lines
2.3 KiB
Plaintext
equalityStrictNulls.ts(59,13): error TS18050: The value 'undefined' cannot be used here.
|
|
equalityStrictNulls.ts(61,13): error TS18050: The value 'undefined' cannot be used here.
|
|
equalityStrictNulls.ts(63,14): error TS18050: The value 'undefined' cannot be used here.
|
|
equalityStrictNulls.ts(65,14): error TS18050: The value 'undefined' cannot be used here.
|
|
|
|
|
|
==== equalityStrictNulls.ts (4 errors) ====
|
|
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) {
|
|
~~~~~~~~~
|
|
!!! error TS18050: The value 'undefined' cannot be used here.
|
|
}
|
|
if (x < undefined) {
|
|
~~~~~~~~~
|
|
!!! error TS18050: The value 'undefined' cannot be used here.
|
|
}
|
|
if (x >= undefined) {
|
|
~~~~~~~~~
|
|
!!! error TS18050: The value 'undefined' cannot be used here.
|
|
}
|
|
if (x <= undefined) {
|
|
~~~~~~~~~
|
|
!!! error TS18050: The value 'undefined' cannot be used here.
|
|
}
|
|
}
|
|
function f5(x: string) {
|
|
switch(x) {
|
|
case null:
|
|
break;
|
|
case undefined:
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
|