TypeScript/tests/baselines/reference/literals.errors.txt

59 lines
2.2 KiB
Plaintext

tests/cases/conformance/expressions/literals/literals.ts(8,10): error TS2531: Object is possibly 'null'.
tests/cases/conformance/expressions/literals/literals.ts(8,17): error TS2531: Object is possibly 'null'.
tests/cases/conformance/expressions/literals/literals.ts(9,9): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/expressions/literals/literals.ts(9,21): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/expressions/literals/literals.ts(19,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
tests/cases/conformance/expressions/literals/literals.ts(24,9): error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'.
==== 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;
~~~~
!!! error TS2531: Object is possibly 'null'.
~~~~
!!! error TS2531: Object is possibly 'null'.
var u = undefined / undefined;
~~~~~~~~~
!!! error TS2532: Object is possibly 'undefined'.
~~~~~~~~~
!!! error TS2532: Object is possibly 'undefined'.
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
~~~
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o1'.
var n = 0x1;
var n = -1;
var n = -1.0;
var n = -1e-4;
var n = -003; // Error in ES5
~~~~
!!! error TS1085: Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '-0o3'.
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 = /\\\\/;