This improves a number of error messages to do with adding 'null' or 'undefined' with other types. It also allows you to add two type parameters that both extend `number`.
27 lines
No EOL
578 B
Text
27 lines
No EOL
578 B
Text
tests/cases/compiler/null.ts(3,7): error TS2365: Operator '+' cannot be applied to types '3' and 'null'.
|
|
|
|
|
|
==== tests/cases/compiler/null.ts (1 errors) ====
|
|
var x=null;
|
|
var y=3+x;
|
|
var z=3+null;
|
|
~~~~~~
|
|
!!! error TS2365: Operator '+' cannot be applied to types '3' and 'null'.
|
|
class C {
|
|
}
|
|
function f() {
|
|
return null;
|
|
return new C();
|
|
}
|
|
function g() {
|
|
return null;
|
|
return 3;
|
|
}
|
|
interface I {
|
|
x:any;
|
|
y:number;
|
|
}
|
|
var w:I={x:null,y:3};
|
|
|
|
|
|
|