Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/baselines/reference/2dArrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class Cell {
}

class Ship {
isSunk: boolean;
isSunk: boolean = false;
}

class Board {
ships: Ship[];
cells: Cell[];
ships: Ship[] = [];
cells: Cell[] = [];

private allShipsSunk() {
return this.ships.every(function (val) { return val.isSunk; });
Expand All @@ -25,11 +25,14 @@ var Cell = /** @class */ (function () {
}());
var Ship = /** @class */ (function () {
function Ship() {
this.isSunk = false;
}
return Ship;
}());
var Board = /** @class */ (function () {
function Board() {
this.ships = [];
this.cells = [];
}
Board.prototype.allShipsSunk = function () {
return this.ships.every(function (val) { return val.isSunk; });
Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/2dArrays.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ class Cell {
class Ship {
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))

isSunk: boolean;
isSunk: boolean = false;
>isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))
}

class Board {
>Board : Symbol(Board, Decl(2dArrays.ts, 5, 1))

ships: Ship[];
ships: Ship[] = [];
>ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13))
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))

cells: Cell[];
>cells : Symbol(Board.cells, Decl(2dArrays.ts, 8, 18))
cells: Cell[] = [];
>cells : Symbol(Board.cells, Decl(2dArrays.ts, 8, 23))
>Cell : Symbol(Cell, Decl(2dArrays.ts, 0, 0))

private allShipsSunk() {
>allShipsSunk : Symbol(Board.allShipsSunk, Decl(2dArrays.ts, 9, 18))
>allShipsSunk : Symbol(Board.allShipsSunk, Decl(2dArrays.ts, 9, 23))

return this.ships.every(function (val) { return val.isSunk; });
>this.ships.every : Symbol(Array.every, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
Expand Down
12 changes: 9 additions & 3 deletions tests/baselines/reference/2dArrays.types
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,28 @@ class Ship {
>Ship : Ship
> : ^^^^

isSunk: boolean;
isSunk: boolean = false;
>isSunk : boolean
> : ^^^^^^^
>false : false
> : ^^^^^
}

class Board {
>Board : Board
> : ^^^^^

ships: Ship[];
ships: Ship[] = [];
>ships : Ship[]
> : ^^^^^^
>[] : undefined[]
> : ^^^^^^^^^^^

cells: Cell[];
cells: Cell[] = [];
>cells : Cell[]
> : ^^^^^^
>[] : undefined[]
> : ^^^^^^^^^^^

private allShipsSunk() {
>allShipsSunk : () => boolean
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function watchMain() {
// You can technically override any given hook on the host, though you probably don't need to.
// Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all.
const origCreateProgram = host.createProgram;
host.createProgram = (rootNames: ReadonlyArray<string>, options, host, oldProgram) => {
host.createProgram = (rootNames: ReadonlyArray<string> | undefined, options, host, oldProgram) => {
console.log("** We're about to create the program! **");
return origCreateProgram(rootNames, options, host, oldProgram);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/abstractPropertyBasics.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class C extends B {
set prop(v) { }
raw = "edge";
readonly ro = "readonly please";
readonlyProp: string; // don't have to give a value, in fact
readonlyProp!: string;
m() { }
}

Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/abstractPropertyBasics.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class C extends B {
readonly ro = "readonly please";
>ro : Symbol(C.ro, Decl(abstractPropertyBasics.ts, 16, 17))

readonlyProp: string; // don't have to give a value, in fact
readonlyProp!: string;
>readonlyProp : Symbol(C.readonlyProp, Decl(abstractPropertyBasics.ts, 17, 36))

m() { }
>m : Symbol(C.m, Decl(abstractPropertyBasics.ts, 18, 25))
>m : Symbol(C.m, Decl(abstractPropertyBasics.ts, 18, 26))
}
2 changes: 1 addition & 1 deletion tests/baselines/reference/abstractPropertyBasics.types
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class C extends B {
>"readonly please" : "readonly please"
> : ^^^^^^^^^^^^^^^^^

readonlyProp: string; // don't have to give a value, in fact
readonlyProp!: string;
>readonlyProp : string
> : ^^^^^^

Expand Down
51 changes: 27 additions & 24 deletions tests/baselines/reference/controlFlowInstanceof.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,22 @@ function f4(s: Set<string> | Set<number>) {

// More tests

class A { a: string }
class A { a: string = "" }
>A : Symbol(A, Decl(controlFlowInstanceof.ts, 41, 1))
>a : Symbol(A.a, Decl(controlFlowInstanceof.ts, 45, 9))

class B extends A { b: string }
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 21))
class B extends A { b: string = "" }
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 26))
>A : Symbol(A, Decl(controlFlowInstanceof.ts, 41, 1))
>b : Symbol(B.b, Decl(controlFlowInstanceof.ts, 46, 19))

class C extends A { c: string }
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 31))
class C extends A { c: string = "" }
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 36))
>A : Symbol(A, Decl(controlFlowInstanceof.ts, 41, 1))
>c : Symbol(C.c, Decl(controlFlowInstanceof.ts, 47, 19))

function foo(x: A | undefined) {
>foo : Symbol(foo, Decl(controlFlowInstanceof.ts, 47, 31))
>foo : Symbol(foo, Decl(controlFlowInstanceof.ts, 47, 36))
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
>A : Symbol(A, Decl(controlFlowInstanceof.ts, 41, 1))

Expand All @@ -135,9 +135,9 @@ function foo(x: A | undefined) {

if (x instanceof B || x instanceof C) {
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 21))
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 26))
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 31))
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 36))

x; // B | C
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
Expand All @@ -147,9 +147,9 @@ function foo(x: A | undefined) {

if (x instanceof B && x instanceof C) {
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 21))
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 26))
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 31))
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 36))

x; // B & C
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
Expand All @@ -167,14 +167,14 @@ function foo(x: A | undefined) {

if (x instanceof B) {
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 21))
>B : Symbol(B, Decl(controlFlowInstanceof.ts, 45, 26))

x; // B
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))

if (x instanceof C) {
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 31))
>C : Symbol(C, Decl(controlFlowInstanceof.ts, 46, 36))

x; // B & C
>x : Symbol(x, Decl(controlFlowInstanceof.ts, 49, 13))
Expand All @@ -200,14 +200,14 @@ function foo(x: A | undefined) {
interface X {
>X : Symbol(X, Decl(controlFlowInstanceof.ts, 77, 1))

x?: string;
x?: string
>x : Symbol(X.x, Decl(controlFlowInstanceof.ts, 82, 13))
}

class Y {
>Y : Symbol(Y, Decl(controlFlowInstanceof.ts, 84, 1))

y: string;
y: string = "";
>y : Symbol(Y.y, Decl(controlFlowInstanceof.ts, 86, 9))
}

Expand Down Expand Up @@ -251,26 +251,29 @@ if (x instanceof ctor) {

// Repro from #27550 (based on uglify code)
=== uglify.js ===
/** @constructor */
/**
* @constructor
* @param {any} val
*/
function AtTop(val) { this.val = val }
>AtTop : Symbol(AtTop, Decl(uglify.js, 0, 0))
>val : Symbol(val, Decl(uglify.js, 1, 15))
>this.val : Symbol(AtTop.val, Decl(uglify.js, 1, 21))
>val : Symbol(val, Decl(uglify.js, 4, 15))
>this.val : Symbol(AtTop.val, Decl(uglify.js, 4, 21))
>this : Symbol(AtTop, Decl(uglify.js, 0, 0))
>val : Symbol(AtTop.val, Decl(uglify.js, 1, 21))
>val : Symbol(val, Decl(uglify.js, 1, 15))
>val : Symbol(AtTop.val, Decl(uglify.js, 4, 21))
>val : Symbol(val, Decl(uglify.js, 4, 15))

/** @type {*} */
var v = 1;
>v : Symbol(v, Decl(uglify.js, 3, 3))
>v : Symbol(v, Decl(uglify.js, 6, 3))

if (v instanceof AtTop) {
>v : Symbol(v, Decl(uglify.js, 3, 3))
>v : Symbol(v, Decl(uglify.js, 6, 3))
>AtTop : Symbol(AtTop, Decl(uglify.js, 0, 0))

v.val
>v.val : Symbol(AtTop.val, Decl(uglify.js, 1, 21))
>v : Symbol(v, Decl(uglify.js, 3, 3))
>val : Symbol(AtTop.val, Decl(uglify.js, 1, 21))
>v.val : Symbol(AtTop.val, Decl(uglify.js, 4, 21))
>v : Symbol(v, Decl(uglify.js, 6, 3))
>val : Symbol(AtTop.val, Decl(uglify.js, 4, 21))
}

23 changes: 17 additions & 6 deletions tests/baselines/reference/controlFlowInstanceof.types
Original file line number Diff line number Diff line change
Expand Up @@ -171,27 +171,33 @@ function f4(s: Set<string> | Set<number>) {

// More tests

class A { a: string }
class A { a: string = "" }
>A : A
> : ^
>a : string
> : ^^^^^^
>"" : ""
> : ^^

class B extends A { b: string }
class B extends A { b: string = "" }
>B : B
> : ^
>A : A
> : ^
>b : string
> : ^^^^^^
>"" : ""
> : ^^

class C extends A { c: string }
class C extends A { c: string = "" }
>C : C
> : ^
>A : A
> : ^
>c : string
> : ^^^^^^
>"" : ""
> : ^^

function foo(x: A | undefined) {
>foo : (x: A | undefined) => void
Expand Down Expand Up @@ -310,7 +316,7 @@ function foo(x: A | undefined) {
// Y is assignable to X, but not a subtype of X

interface X {
x?: string;
x?: string
>x : string | undefined
> : ^^^^^^^^^^^^^^^^^^
}
Expand All @@ -319,9 +325,11 @@ class Y {
>Y : Y
> : ^

y: string;
y: string = "";
>y : string
> : ^^^^^^
>"" : ""
> : ^^
}

function goo(x: X) {
Expand Down Expand Up @@ -382,7 +390,10 @@ if (x instanceof ctor) {

// Repro from #27550 (based on uglify code)
=== uglify.js ===
/** @constructor */
/**
* @constructor
* @param {any} val
*/
function AtTop(val) { this.val = val }
>AtTop : typeof AtTop
> : ^^^^^^^^^^^^
Expand Down
Loading
Loading