52 lines
No EOL
1.5 KiB
Text
52 lines
No EOL
1.5 KiB
Text
==== tests/cases/conformance/expressions/literals/literals.ts (6 errors) ====
|
|
|
|
//typeof null is Null
|
|
//typeof true is Boolean
|
|
//typeof false is Boolean
|
|
//typeof numeric literal is Number
|
|
//typeof string literal is String
|
|
//typeof regex literal is Regex
|
|
|
|
var nu = null / null;
|
|
~~~~
|
|
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
~~~~
|
|
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
var u = undefined / undefined;
|
|
~~~~~~~~~
|
|
!!! The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
~~~~~~~~~
|
|
!!! The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
|
|
|
|
var b: boolean;
|
|
var b = true;
|
|
var b = false;
|
|
|
|
var n: number;
|
|
var n = 1;
|
|
var n = 1.0;
|
|
var n = 1e4;
|
|
var n = 001; // Error in ES5
|
|
~~~
|
|
!!! Octal literals are not available when targeting ECMAScript 5 and higher.
|
|
var n = 0x1;
|
|
var n = -1;
|
|
var n = -1.0;
|
|
var n = -1e-4;
|
|
var n = -003; // Error in ES5
|
|
~~~
|
|
!!! Octal literals are not available when targeting ECMAScript 5 and higher.
|
|
var n = -0x1;
|
|
|
|
var s: string;
|
|
var s = '';
|
|
var s = "";
|
|
var s = 'foo\
|
|
bar';
|
|
var s = "foo\
|
|
bar";
|
|
|
|
var r: RegExp;
|
|
var r = /what/;
|
|
var r = /\\\\/;
|
|
|