From f96c058c75d15a24c2b780804bcad8898fb643e0 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 3 Feb 2026 23:02:13 +0000 Subject: [PATCH] Accepted baselines. --- ...ryIntegerLiteral(target=es2015).errors.txt | 60 +++++++ .../binaryIntegerLiteral(target=es2015).js | 1 + .../binaryIntegerLiteral(target=es2015).types | 9 +- ...inaryIntegerLiteral(target=es5).errors.txt | 17 +- .../binaryIntegerLiteral(target=es5).js | 1 + .../binaryIntegerLiteralES6.errors.txt | 61 +++++++ .../reference/binaryIntegerLiteralES6.js | 1 + .../reference/binaryIntegerLiteralES6.types | 9 +- .../reference/binaryIntegerLiteralError.js | 1 + ...TypeWithUnionTypeCallSignatures.errors.txt | 45 ++++++ ...ntextualTypeWithUnionTypeCallSignatures.js | 1 + ...ualTypeWithUnionTypeCallSignatures.symbols | 2 - ...xtualTypeWithUnionTypeCallSignatures.types | 27 ++-- ...textualTypeWithUnionTypeIndexSignatures.js | 1 + ...textualTypeWithUnionTypeMembers.errors.txt | 152 ++++++++++++++++++ .../contextualTypeWithUnionTypeMembers.js | 1 + .../contextualTypeWithUnionTypeMembers.types | 4 +- ...ontextualTypeWithUnionTypeObjectLiteral.js | 1 + ...extualTypeWithUnionTypeObjectLiteral.types | 8 +- ...alIntegerLiteral(target=es2015).errors.txt | 58 +++++++ .../octalIntegerLiteral(target=es2015).js | 1 + .../octalIntegerLiteral(target=es2015).types | 9 +- ...octalIntegerLiteral(target=es5).errors.txt | 19 ++- .../octalIntegerLiteral(target=es5).js | 1 + .../octalIntegerLiteralES6.errors.txt | 58 +++++++ .../reference/octalIntegerLiteralES6.js | 1 + .../reference/octalIntegerLiteralES6.types | 9 +- .../reference/octalIntegerLiteralError.js | 1 + 28 files changed, 524 insertions(+), 35 deletions(-) create mode 100644 tests/baselines/reference/binaryIntegerLiteral(target=es2015).errors.txt create mode 100644 tests/baselines/reference/binaryIntegerLiteralES6.errors.txt create mode 100644 tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.errors.txt create mode 100644 tests/baselines/reference/contextualTypeWithUnionTypeMembers.errors.txt create mode 100644 tests/baselines/reference/octalIntegerLiteral(target=es2015).errors.txt create mode 100644 tests/baselines/reference/octalIntegerLiteralES6.errors.txt diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es2015).errors.txt b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).errors.txt new file mode 100644 index 00000000000..f6f60fbcd43 --- /dev/null +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).errors.txt @@ -0,0 +1,60 @@ +binaryIntegerLiteral.ts(25,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0b11010"' can't be used to index type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. + Property '0b11010' does not exist on type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. +binaryIntegerLiteral.ts(34,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0B11010"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + Property '0B11010' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +binaryIntegerLiteral.ts(40,1): error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + Property 'Infinity' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + + +==== binaryIntegerLiteral.ts (3 errors) ==== + var bin1 = 0b11010; + var bin2 = 0B11010; + var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; + var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111; + + var obj1 = { + 0b11010: "Hello", + a: bin1, + bin1, + b: 0b11010, + 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111: true, + } + + var obj2 = { + 0B11010: "World", + a: bin2, + bin2, + b: 0B11010, + 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111: false, + } + + obj1[0b11010]; // string + obj1[26]; // string + obj1["26"]; // string + obj1["0b11010"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0b11010"' can't be used to index type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. +!!! error TS7053: Property '0b11010' does not exist on type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. + obj1["a"]; // number + obj1["b"]; // number + obj1["bin1"]; // number + obj1["Infinity"]; // boolean + + obj2[0B11010]; // string + obj2[26]; // string + obj2["26"]; // string + obj2["0B11010"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0B11010"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +!!! error TS7053: Property '0B11010' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + obj2["a"]; // number + obj2["b"]; // number + obj2["bin2"]; // number + obj2[9.671406556917009e+24]; // boolean + obj2["9.671406556917009e+24"]; // boolean + obj2["Infinity"]; // any + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +!!! error TS7053: Property 'Infinity' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + + \ No newline at end of file diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es2015).js b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).js index b94113e58af..259fe97f171 100644 --- a/tests/baselines/reference/binaryIntegerLiteral(target=es2015).js +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).js @@ -45,6 +45,7 @@ obj2["Infinity"]; // any //// [binaryIntegerLiteral.js] +"use strict"; var bin1 = 0b11010; var bin2 = 0B11010; var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es2015).types b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).types index 9bb5101b0e3..50471191dce 100644 --- a/tests/baselines/reference/binaryIntegerLiteral(target=es2015).types +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es2015).types @@ -120,7 +120,8 @@ obj1["26"]; // string > : ^^^^ obj1["0b11010"]; // any ->obj1["0b11010"] : error +>obj1["0b11010"] : any +> : ^^^ >obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0b11010" : "0b11010" @@ -183,7 +184,8 @@ obj2["26"]; // string > : ^^^^ obj2["0B11010"]; // any ->obj2["0B11010"] : error +>obj2["0B11010"] : any +> : ^^^ >obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0B11010" : "0B11010" @@ -230,7 +232,8 @@ obj2["9.671406556917009e+24"]; // boolean > : ^^^^^^^^^^^^^^^^^^^^^^^ obj2["Infinity"]; // any ->obj2["Infinity"] : error +>obj2["Infinity"] : any +> : ^^^ >obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"Infinity" : "Infinity" diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es5).errors.txt b/tests/baselines/reference/binaryIntegerLiteral(target=es5).errors.txt index 63348f01a84..c83a57bfb69 100644 --- a/tests/baselines/reference/binaryIntegerLiteral(target=es5).errors.txt +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es5).errors.txt @@ -1,8 +1,14 @@ error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +binaryIntegerLiteral.ts(25,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0b11010"' can't be used to index type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. + Property '0b11010' does not exist on type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. +binaryIntegerLiteral.ts(34,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0B11010"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + Property '0B11010' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +binaryIntegerLiteral.ts(40,1): error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + Property 'Infinity' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. !!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -==== binaryIntegerLiteral.ts (0 errors) ==== +==== binaryIntegerLiteral.ts (3 errors) ==== var bin1 = 0b11010; var bin2 = 0B11010; var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; @@ -28,6 +34,9 @@ error TS5107: Option 'target=ES5' is deprecated and will stop functioning in Typ obj1[26]; // string obj1["26"]; // string obj1["0b11010"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0b11010"' can't be used to index type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. +!!! error TS7053: Property '0b11010' does not exist on type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. obj1["a"]; // number obj1["b"]; // number obj1["bin1"]; // number @@ -37,11 +46,17 @@ error TS5107: Option 'target=ES5' is deprecated and will stop functioning in Typ obj2[26]; // string obj2["26"]; // string obj2["0B11010"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0B11010"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +!!! error TS7053: Property '0B11010' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. obj2["a"]; // number obj2["b"]; // number obj2["bin2"]; // number obj2[9.671406556917009e+24]; // boolean obj2["9.671406556917009e+24"]; // boolean obj2["Infinity"]; // any + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +!!! error TS7053: Property 'Infinity' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. \ No newline at end of file diff --git a/tests/baselines/reference/binaryIntegerLiteral(target=es5).js b/tests/baselines/reference/binaryIntegerLiteral(target=es5).js index da55042b1a9..7ced848a14c 100644 --- a/tests/baselines/reference/binaryIntegerLiteral(target=es5).js +++ b/tests/baselines/reference/binaryIntegerLiteral(target=es5).js @@ -45,6 +45,7 @@ obj2["Infinity"]; // any //// [binaryIntegerLiteral.js] +"use strict"; var bin1 = 26; var bin2 = 26; var bin3 = 9.671406556917009e+24; diff --git a/tests/baselines/reference/binaryIntegerLiteralES6.errors.txt b/tests/baselines/reference/binaryIntegerLiteralES6.errors.txt new file mode 100644 index 00000000000..9e571c6de82 --- /dev/null +++ b/tests/baselines/reference/binaryIntegerLiteralES6.errors.txt @@ -0,0 +1,61 @@ +binaryIntegerLiteralES6.ts(25,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0b11010"' can't be used to index type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. + Property '0b11010' does not exist on type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. +binaryIntegerLiteralES6.ts(34,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0B11010"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + Property '0B11010' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +binaryIntegerLiteralES6.ts(40,1): error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + Property 'Infinity' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + + +==== binaryIntegerLiteralES6.ts (3 errors) ==== + var bin1 = 0b11010; + var bin2 = 0B11010; + var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; + var bin4 = 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111; + + var obj1 = { + 0b11010: "Hello", + a: bin1, + bin1, + b: 0b11010, + 0B111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101001010100000010111110001111111111: true, + } + + var obj2 = { + 0B11010: "World", + a: bin2, + bin2, + b: 0B11010, + 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111: false, + } + + obj1[0b11010]; // string + obj1[26]; // string + obj1["26"]; // string + obj1["0b11010"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0b11010"' can't be used to index type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. +!!! error TS7053: Property '0b11010' does not exist on type '{ 26: string; a: number; bin1: number; b: number; Infinity: boolean; }'. + obj1["a"]; // number + obj1["b"]; // number + obj1["bin1"]; // number + obj1["Infinity"]; // boolean + + obj2[0B11010]; // string + obj2[26]; // string + obj2["26"]; // string + obj2["0B11010"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0B11010"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +!!! error TS7053: Property '0B11010' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + obj2["a"]; // number + obj2["b"]; // number + obj2["bin2"]; // number + obj2[9.671406556917009e+24]; // boolean + obj2["9.671406556917009e+24"]; // boolean + obj2["Infinity"]; // any + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. +!!! error TS7053: Property 'Infinity' does not exist on type '{ 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; }'. + + + \ No newline at end of file diff --git a/tests/baselines/reference/binaryIntegerLiteralES6.js b/tests/baselines/reference/binaryIntegerLiteralES6.js index f5f939072bc..495479b3620 100644 --- a/tests/baselines/reference/binaryIntegerLiteralES6.js +++ b/tests/baselines/reference/binaryIntegerLiteralES6.js @@ -46,6 +46,7 @@ obj2["Infinity"]; // any //// [binaryIntegerLiteralES6.js] +"use strict"; var bin1 = 0b11010; var bin2 = 0B11010; var bin3 = 0B11111111111111111111111111111111111111111111111101001010100000010111110001111111111; diff --git a/tests/baselines/reference/binaryIntegerLiteralES6.types b/tests/baselines/reference/binaryIntegerLiteralES6.types index 8d0eeeb271a..c0a9f5e8bb1 100644 --- a/tests/baselines/reference/binaryIntegerLiteralES6.types +++ b/tests/baselines/reference/binaryIntegerLiteralES6.types @@ -120,7 +120,8 @@ obj1["26"]; // string > : ^^^^ obj1["0b11010"]; // any ->obj1["0b11010"] : error +>obj1["0b11010"] : any +> : ^^^ >obj1 : { 26: string; a: number; bin1: number; b: number; Infinity: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0b11010" : "0b11010" @@ -183,7 +184,8 @@ obj2["26"]; // string > : ^^^^ obj2["0B11010"]; // any ->obj2["0B11010"] : error +>obj2["0B11010"] : any +> : ^^^ >obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0B11010" : "0B11010" @@ -230,7 +232,8 @@ obj2["9.671406556917009e+24"]; // boolean > : ^^^^^^^^^^^^^^^^^^^^^^^ obj2["Infinity"]; // any ->obj2["Infinity"] : error +>obj2["Infinity"] : any +> : ^^^ >obj2 : { 26: string; a: number; bin2: number; b: number; 9.671406556917009e+24: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"Infinity" : "Infinity" diff --git a/tests/baselines/reference/binaryIntegerLiteralError.js b/tests/baselines/reference/binaryIntegerLiteralError.js index dacb4a2a29b..a4df10b5565 100644 --- a/tests/baselines/reference/binaryIntegerLiteralError.js +++ b/tests/baselines/reference/binaryIntegerLiteralError.js @@ -13,6 +13,7 @@ var obj1 = { //// [binaryIntegerLiteralError.js] +"use strict"; // error var bin1 = 0B110; 2110; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.errors.txt b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.errors.txt new file mode 100644 index 00000000000..3a81d214da6 --- /dev/null +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.errors.txt @@ -0,0 +1,45 @@ +contextualTypeWithUnionTypeCallSignatures.ts(33,54): error TS7006: Parameter 'a' implicitly has an 'any' type. +contextualTypeWithUnionTypeCallSignatures.ts(36,54): error TS7006: Parameter 'a' implicitly has an 'any' type. + + +==== contextualTypeWithUnionTypeCallSignatures.ts (2 errors) ==== + //When used as a contextual type, a union type U has those members that are present in any of + // its constituent types, with types that are unions of the respective members in the constituent types. + + // Let S be the set of types in U that have call signatures. + // If S is not empty and the sets of call signatures of the types in S are identical ignoring return types, + // U has the same set of call signatures, but with return types that are unions of the return types of the respective call signatures from each type in S. + + interface IWithNoCallSignatures { + foo: string; + } + interface IWithCallSignatures { + (a: number): string; + } + interface IWithCallSignatures2 { + (a: number): number; + } + interface IWithCallSignatures3 { + (b: string): number; + } + interface IWithCallSignatures4 { + (a: number): string; + (a: string, b: number): number; + } + + // With no call signature | callSignatures + var x: IWithNoCallSignatures | IWithCallSignatures = a => a.toString(); + + // With call signatures with different return type + var x2: IWithCallSignatures | IWithCallSignatures2 = a => a.toString(); // Like iWithCallSignatures + var x2: IWithCallSignatures | IWithCallSignatures2 = a => a; // Like iWithCallSignatures2 + + // With call signatures of mismatching parameter type + var x3: IWithCallSignatures | IWithCallSignatures3 = a => /*here a should be any*/ a.toString(); + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. + + // With call signature count mismatch + var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any*/ a.toString(); + ~ +!!! error TS7006: Parameter 'a' implicitly has an 'any' type. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.js b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.js index ec2a7f79263..0f41c17720a 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.js @@ -39,6 +39,7 @@ var x3: IWithCallSignatures | IWithCallSignatures3 = a => /*here a should be any var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any*/ a.toString(); //// [contextualTypeWithUnionTypeCallSignatures.js] +"use strict"; //When used as a contextual type, a union type U has those members that are present in any of // its constituent types, with types that are unions of the respective members in the constituent types. // With no call signature | callSignatures diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols index 545d5aece2c..a581f195638 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols @@ -84,7 +84,5 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any >IWithCallSignatures : Symbol(IWithCallSignatures, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 9, 1)) >IWithCallSignatures4 : Symbol(IWithCallSignatures4, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 18, 1)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52)) ->a.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52)) ->toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types index d5470ad755e..8fa6aa96632 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types @@ -91,8 +91,11 @@ var x3: IWithCallSignatures | IWithCallSignatures3 = a => /*here a should be any >a => /*here a should be any*/ a.toString() : (a: any) => any > : ^ ^^^^^^^^^^^^^ >a : any +> : ^^^ >a.toString() : any +> : ^^^ >a.toString : any +> : ^^^ >a : any > : ^^^ >toString : any @@ -102,16 +105,16 @@ var x3: IWithCallSignatures | IWithCallSignatures3 = a => /*here a should be any var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any*/ a.toString(); >x4 : IWithCallSignatures | IWithCallSignatures4 > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->a => /*here a should be any*/ a.toString() : (a: number) => string -> : ^ ^^^^^^^^^^^^^^^^^^^ ->a : number -> : ^^^^^^ ->a.toString() : string -> : ^^^^^^ ->a.toString : (radix?: number) => string -> : ^ ^^^ ^^^^^ ->a : number -> : ^^^^^^ ->toString : (radix?: number) => string -> : ^ ^^^ ^^^^^ +>a => /*here a should be any*/ a.toString() : (a: any) => any +> : ^ ^^^^^^^^^^^^^ +>a : any +> : ^^^ +>a.toString() : any +> : ^^^ +>a.toString : any +> : ^^^ +>a : any +> : ^^^ +>toString : any +> : ^^^ diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.js b/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.js index 7a0954e3426..f4e4e5005d5 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeIndexSignatures.js @@ -57,6 +57,7 @@ var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a.to var x4: IWithNumberIndexSignature1 | IWithNumberIndexSignature2 = { 1: a => a }; // a should be number //// [contextualTypeWithUnionTypeIndexSignatures.js] +"use strict"; // When an object literal is contextually typed by a type that includes a string index signature, // the resulting type of the object literal includes a string index signature with the union type of // the types of the properties declared in the object literal, or the Undefined type if the object literal diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.errors.txt b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.errors.txt new file mode 100644 index 00000000000..cadd0a274db --- /dev/null +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.errors.txt @@ -0,0 +1,152 @@ +contextualTypeWithUnionTypeMembers.ts(24,39): error TS2454: Variable 'i1' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(25,39): error TS2454: Variable 'i2' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(52,52): error TS2454: Variable 'i1' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(52,56): error TS2454: Variable 'i2' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(87,27): error TS2454: Variable 'i11' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(88,27): error TS2454: Variable 'i21' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(105,42): error TS2454: Variable 'i11' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(105,47): error TS2454: Variable 'i21' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(105,52): error TS2454: Variable 'i11' is used before being assigned. +contextualTypeWithUnionTypeMembers.ts(105,59): error TS2454: Variable 'i21' is used before being assigned. + + +==== contextualTypeWithUnionTypeMembers.ts (10 errors) ==== + //When used as a contextual type, a union type U has those members that are present in any of + // its constituent types, with types that are unions of the respective members in the constituent types. + interface I1 { + commonMethodType(a: string): string; + commonPropertyType: string; + commonMethodWithTypeParameter(a: T): T; + + methodOnlyInI1(a: string): string; + propertyOnlyInI1: string; + } + interface I2 { + commonMethodType(a: string): string; + commonPropertyType: string; + commonMethodWithTypeParameter(a: T): T; + + methodOnlyInI2(a: string): string; + propertyOnlyInI2: string; + } + + // Let S be the set of types in U that has a property P. + // If S is not empty, U has a property P of a union type of the types of P from each type in S. + var i1: I1; + var i2: I2; + var i1Ori2: I1 | I2 = i1; + ~~ +!!! error TS2454: Variable 'i1' is used before being assigned. + var i1Ori2: I1 | I2 = i2; + ~~ +!!! error TS2454: Variable 'i2' is used before being assigned. + var i1Ori2: I1 | I2 = { // Like i1 + commonPropertyType: "hello", + commonMethodType: a=> a, + commonMethodWithTypeParameter: a => a, + + methodOnlyInI1: a => a, + propertyOnlyInI1: "Hello", + }; + var i1Ori2: I1 | I2 = { // Like i2 + commonPropertyType: "hello", + commonMethodType: a=> a, + commonMethodWithTypeParameter: a => a, + + methodOnlyInI2: a => a, + propertyOnlyInI2: "Hello", + }; + var i1Ori2: I1 | I2 = { // Like i1 and i2 both + commonPropertyType: "hello", + commonMethodType: a=> a, + commonMethodWithTypeParameter: a => a, + methodOnlyInI1: a => a, + propertyOnlyInI1: "Hello", + methodOnlyInI2: a => a, + propertyOnlyInI2: "Hello", + }; + + var arrayI1OrI2: Array | I2> = [i1, i2, { // Like i1 + ~~ +!!! error TS2454: Variable 'i1' is used before being assigned. + ~~ +!!! error TS2454: Variable 'i2' is used before being assigned. + commonPropertyType: "hello", + commonMethodType: a=> a, + commonMethodWithTypeParameter: a => a, + + methodOnlyInI1: a => a, + propertyOnlyInI1: "Hello", + }, + { // Like i2 + commonPropertyType: "hello", + commonMethodType: a=> a, + commonMethodWithTypeParameter: a => a, + + methodOnlyInI2: a => a, + propertyOnlyInI2: "Hello", + }, { // Like i1 and i2 both + commonPropertyType: "hello", + commonMethodType: a=> a, + commonMethodWithTypeParameter: a => a, + methodOnlyInI1: a => a, + propertyOnlyInI1: "Hello", + methodOnlyInI2: a => a, + propertyOnlyInI2: "Hello", + }]; + + interface I11 { + commonMethodDifferentReturnType(a: string, b: number): string; + commonPropertyDifferentType: string; + } + interface I21 { + commonMethodDifferentReturnType(a: string, b: number): number; + commonPropertyDifferentType: number; + } + var i11: I11; + var i21: I21; + var i11Ori21: I11 | I21 = i11; + ~~~ +!!! error TS2454: Variable 'i11' is used before being assigned. + var i11Ori21: I11 | I21 = i21; + ~~~ +!!! error TS2454: Variable 'i21' is used before being assigned. + var i11Ori21: I11 | I21 = { + // Like i1 + commonMethodDifferentReturnType: (a, b) => { + var z = a.charAt(b); + return z; + }, + commonPropertyDifferentType: "hello", + }; + var i11Ori21: I11 | I21 = { + // Like i2 + commonMethodDifferentReturnType: (a, b) => { + var z = a.charCodeAt(b); + return z; + }, + commonPropertyDifferentType: 10, + }; + var arrayOrI11OrI21: Array = [i11, i21, i11 || i21, { + ~~~ +!!! error TS2454: Variable 'i11' is used before being assigned. + ~~~ +!!! error TS2454: Variable 'i21' is used before being assigned. + ~~~ +!!! error TS2454: Variable 'i11' is used before being assigned. + ~~~ +!!! error TS2454: Variable 'i21' is used before being assigned. + // Like i1 + commonMethodDifferentReturnType: (a, b) => { + var z = a.charAt(b); + return z; + }, + commonPropertyDifferentType: "hello", + }, { + // Like i2 + commonMethodDifferentReturnType: (a, b) => { + var z = a.charCodeAt(b); + return z; + }, + commonPropertyDifferentType: 10, + }]; \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js index 807f26cacd3..6214c2460ce 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js @@ -122,6 +122,7 @@ var arrayOrI11OrI21: Array = [i11, i21, i11 || i21, { }]; //// [contextualTypeWithUnionTypeMembers.js] +"use strict"; // Let S be the set of types in U that has a property P. // If S is not empty, U has a property P of a union type of the types of P from each type in S. var i1; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types index d3f6a07dc27..90a98a5cc35 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.types @@ -550,8 +550,8 @@ var arrayOrI11OrI21: Array = [i11, i21, i11 || i21, { > : ^^^ >i21 : I21 > : ^^^ ->i11 || i21 : I11 | I21 -> : ^^^^^^^^^ +>i11 || i21 : I11 +> : ^^^ >i11 : I11 > : ^^^ >i21 : I21 diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.js b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.js index bfc3324a70a..d5c09adf65f 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.js @@ -62,6 +62,7 @@ var i11Ori21: I11 | I21 = { // Like i1 and i2 both }; //// [contextualTypeWithUnionTypeObjectLiteral.js] +"use strict"; var strOrNumber = str || num; var objStrOrNum1 = objStr || objNum; var objStrOrNum2 = objStr || objNum; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.types b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.types index 2079eaad234..8d8cd2c47c6 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeObjectLiteral.types @@ -38,8 +38,8 @@ var objStrOrNum1: { prop: string } | { prop: number } = objStr || objNum; > : ^^^^^^ >prop : number > : ^^^^^^ ->objStr || objNum : { prop: string; } | { prop: number; } -> : ^^^^^^^^ ^^^^^^^^^^^^^^ ^^^ +>objStr || objNum : { prop: string; } +> : ^^^^^^^^ ^^^ >objStr : { prop: string; } > : ^^^^^^^^ ^^^ >objNum : { prop: number; } @@ -50,8 +50,8 @@ var objStrOrNum2: { prop: string | number } = objStr || objNum; > : ^^^^^^^^ ^^^ >prop : string | number > : ^^^^^^^^^^^^^^^ ->objStr || objNum : { prop: string; } | { prop: number; } -> : ^^^^^^^^ ^^^^^^^^^^^^^^ ^^^ +>objStr || objNum : { prop: string; } +> : ^^^^^^^^ ^^^ >objStr : { prop: string; } > : ^^^^^^^^ ^^^ >objNum : { prop: number; } diff --git a/tests/baselines/reference/octalIntegerLiteral(target=es2015).errors.txt b/tests/baselines/reference/octalIntegerLiteral(target=es2015).errors.txt new file mode 100644 index 00000000000..0f10c990611 --- /dev/null +++ b/tests/baselines/reference/octalIntegerLiteral(target=es2015).errors.txt @@ -0,0 +1,58 @@ +octalIntegerLiteral.ts(23,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0o45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. + Property '0o45436' does not exist on type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. +octalIntegerLiteral.ts(32,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0O45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + Property '0O45436' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +octalIntegerLiteral.ts(40,1): error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + Property 'Infinity' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + + +==== octalIntegerLiteral.ts (3 errors) ==== + var oct1 = 0o45436; + var oct2 = 0O45436; + var oct3 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777; + var oct4 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777; + + var obj1 = { + 0o45436: "Hello", + a: 0o45436, + b: oct1, + oct1, + 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777: true + } + + var obj2 = { + 0O45436: "hi", + a: 0O45436, + b: oct2, + oct2, + 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777: false, + } + + obj1[0o45436]; // string + obj1["0o45436"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0o45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. +!!! error TS7053: Property '0o45436' does not exist on type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. + obj1["19230"]; // string + obj1[19230]; // string + obj1["a"]; // number + obj1["b"]; // number + obj1["oct1"]; // number + obj1["Infinity"]; // boolean + + obj2[0O45436]; // string + obj2["0O45436"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0O45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +!!! error TS7053: Property '0O45436' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + obj2["19230"]; // string + obj2[19230]; // string + obj2["a"]; // number + obj2["b"]; // number + obj2["oct2"]; // number + obj2[5.462437423415177e+244]; // boolean + obj2["5.462437423415177e+244"]; // boolean + obj2["Infinity"]; // any + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +!!! error TS7053: Property 'Infinity' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. \ No newline at end of file diff --git a/tests/baselines/reference/octalIntegerLiteral(target=es2015).js b/tests/baselines/reference/octalIntegerLiteral(target=es2015).js index 8aa9b0b3091..ab24eaf480b 100644 --- a/tests/baselines/reference/octalIntegerLiteral(target=es2015).js +++ b/tests/baselines/reference/octalIntegerLiteral(target=es2015).js @@ -43,6 +43,7 @@ obj2["5.462437423415177e+244"]; // boolean obj2["Infinity"]; // any //// [octalIntegerLiteral.js] +"use strict"; var oct1 = 0o45436; var oct2 = 0O45436; var oct3 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777; diff --git a/tests/baselines/reference/octalIntegerLiteral(target=es2015).types b/tests/baselines/reference/octalIntegerLiteral(target=es2015).types index 9f31cbad6f9..ee7f3cb6509 100644 --- a/tests/baselines/reference/octalIntegerLiteral(target=es2015).types +++ b/tests/baselines/reference/octalIntegerLiteral(target=es2015).types @@ -104,7 +104,8 @@ obj1[0o45436]; // string > : ^^^^^ obj1["0o45436"]; // any ->obj1["0o45436"] : error +>obj1["0o45436"] : any +> : ^^^ >obj1 : { 19230: string; a: number; b: number; oct1: number; Infinity: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0o45436" : "0o45436" @@ -167,7 +168,8 @@ obj2[0O45436]; // string > : ^^^^^ obj2["0O45436"]; // any ->obj2["0O45436"] : error +>obj2["0O45436"] : any +> : ^^^ >obj2 : { 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0O45436" : "0O45436" @@ -230,7 +232,8 @@ obj2["5.462437423415177e+244"]; // boolean > : ^^^^^^^^^^^^^^^^^^^^^^^^ obj2["Infinity"]; // any ->obj2["Infinity"] : error +>obj2["Infinity"] : any +> : ^^^ >obj2 : { 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"Infinity" : "Infinity" diff --git a/tests/baselines/reference/octalIntegerLiteral(target=es5).errors.txt b/tests/baselines/reference/octalIntegerLiteral(target=es5).errors.txt index 3de81150929..ba13933d49e 100644 --- a/tests/baselines/reference/octalIntegerLiteral(target=es5).errors.txt +++ b/tests/baselines/reference/octalIntegerLiteral(target=es5).errors.txt @@ -1,8 +1,14 @@ error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. +octalIntegerLiteral.ts(23,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0o45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. + Property '0o45436' does not exist on type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. +octalIntegerLiteral.ts(32,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0O45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + Property '0O45436' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +octalIntegerLiteral.ts(40,1): error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + Property 'Infinity' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. !!! error TS5107: Option 'target=ES5' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error. -==== octalIntegerLiteral.ts (0 errors) ==== +==== octalIntegerLiteral.ts (3 errors) ==== var oct1 = 0o45436; var oct2 = 0O45436; var oct3 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777; @@ -26,6 +32,9 @@ error TS5107: Option 'target=ES5' is deprecated and will stop functioning in Typ obj1[0o45436]; // string obj1["0o45436"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0o45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. +!!! error TS7053: Property '0o45436' does not exist on type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. obj1["19230"]; // string obj1[19230]; // string obj1["a"]; // number @@ -35,6 +44,9 @@ error TS5107: Option 'target=ES5' is deprecated and will stop functioning in Typ obj2[0O45436]; // string obj2["0O45436"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0O45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +!!! error TS7053: Property '0O45436' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. obj2["19230"]; // string obj2[19230]; // string obj2["a"]; // number @@ -42,4 +54,7 @@ error TS5107: Option 'target=ES5' is deprecated and will stop functioning in Typ obj2["oct2"]; // number obj2[5.462437423415177e+244]; // boolean obj2["5.462437423415177e+244"]; // boolean - obj2["Infinity"]; // any \ No newline at end of file + obj2["Infinity"]; // any + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +!!! error TS7053: Property 'Infinity' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. \ No newline at end of file diff --git a/tests/baselines/reference/octalIntegerLiteral(target=es5).js b/tests/baselines/reference/octalIntegerLiteral(target=es5).js index 45c4e2c9056..6c686e95d6f 100644 --- a/tests/baselines/reference/octalIntegerLiteral(target=es5).js +++ b/tests/baselines/reference/octalIntegerLiteral(target=es5).js @@ -43,6 +43,7 @@ obj2["5.462437423415177e+244"]; // boolean obj2["Infinity"]; // any //// [octalIntegerLiteral.js] +"use strict"; var oct1 = 19230; var oct2 = 19230; var oct3 = Infinity; diff --git a/tests/baselines/reference/octalIntegerLiteralES6.errors.txt b/tests/baselines/reference/octalIntegerLiteralES6.errors.txt new file mode 100644 index 00000000000..3e2c2b88e68 --- /dev/null +++ b/tests/baselines/reference/octalIntegerLiteralES6.errors.txt @@ -0,0 +1,58 @@ +octalIntegerLiteralES6.ts(23,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0o45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. + Property '0o45436' does not exist on type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. +octalIntegerLiteralES6.ts(32,1): error TS7053: Element implicitly has an 'any' type because expression of type '"0O45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + Property '0O45436' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +octalIntegerLiteralES6.ts(40,1): error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + Property 'Infinity' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + + +==== octalIntegerLiteralES6.ts (3 errors) ==== + var oct1 = 0o45436; + var oct2 = 0O45436; + var oct3 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777; + var oct4 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777; + + var obj1 = { + 0o45436: "Hello", + a: 0o45436, + b: oct1, + oct1, + 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777: true + } + + var obj2 = { + 0O45436: "hi", + a: 0O45436, + b: oct2, + oct2, + 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777: false, + } + + obj1[0o45436]; // string + obj1["0o45436"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0o45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. +!!! error TS7053: Property '0o45436' does not exist on type '{ 19230: string; a: number; b: number; oct1: number; Infinity: boolean; }'. + obj1["19230"]; // string + obj1[19230]; // string + obj1["a"]; // number + obj1["b"]; // number + obj1["oct1"]; // number + obj1["Infinity"]; // boolean + + obj2[0O45436]; // string + obj2["0O45436"]; // any + ~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"0O45436"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +!!! error TS7053: Property '0O45436' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. + obj2["19230"]; // string + obj2[19230]; // string + obj2["a"]; // number + obj2["b"]; // number + obj2["oct2"]; // number + obj2[5.462437423415177e+244]; // boolean + obj2["5.462437423415177e+244"]; // boolean + obj2["Infinity"]; // any + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"Infinity"' can't be used to index type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. +!!! error TS7053: Property 'Infinity' does not exist on type '{ 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; }'. \ No newline at end of file diff --git a/tests/baselines/reference/octalIntegerLiteralES6.js b/tests/baselines/reference/octalIntegerLiteralES6.js index 702904caae1..91fc13b61db 100644 --- a/tests/baselines/reference/octalIntegerLiteralES6.js +++ b/tests/baselines/reference/octalIntegerLiteralES6.js @@ -43,6 +43,7 @@ obj2["5.462437423415177e+244"]; // boolean obj2["Infinity"]; // any //// [octalIntegerLiteralES6.js] +"use strict"; var oct1 = 0o45436; var oct2 = 0O45436; var oct3 = 0o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777; diff --git a/tests/baselines/reference/octalIntegerLiteralES6.types b/tests/baselines/reference/octalIntegerLiteralES6.types index e51fe63ecc6..6bdea159c08 100644 --- a/tests/baselines/reference/octalIntegerLiteralES6.types +++ b/tests/baselines/reference/octalIntegerLiteralES6.types @@ -104,7 +104,8 @@ obj1[0o45436]; // string > : ^^^^^ obj1["0o45436"]; // any ->obj1["0o45436"] : error +>obj1["0o45436"] : any +> : ^^^ >obj1 : { 19230: string; a: number; b: number; oct1: number; Infinity: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0o45436" : "0o45436" @@ -167,7 +168,8 @@ obj2[0O45436]; // string > : ^^^^^ obj2["0O45436"]; // any ->obj2["0O45436"] : error +>obj2["0O45436"] : any +> : ^^^ >obj2 : { 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"0O45436" : "0O45436" @@ -230,7 +232,8 @@ obj2["5.462437423415177e+244"]; // boolean > : ^^^^^^^^^^^^^^^^^^^^^^^^ obj2["Infinity"]; // any ->obj2["Infinity"] : error +>obj2["Infinity"] : any +> : ^^^ >obj2 : { 19230: string; a: number; b: number; oct2: number; 5.462437423415177e+244: boolean; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"Infinity" : "Infinity" diff --git a/tests/baselines/reference/octalIntegerLiteralError.js b/tests/baselines/reference/octalIntegerLiteralError.js index 7019696f473..58577c767dd 100644 --- a/tests/baselines/reference/octalIntegerLiteralError.js +++ b/tests/baselines/reference/octalIntegerLiteralError.js @@ -13,6 +13,7 @@ var obj1 = { //// [octalIntegerLiteralError.js] +"use strict"; // error var oct1 = 0O13334; 823;