Skip to content

Commit e13a2e7

Browse files
Merge pull request #609 from microsoft/main
Create a new pull request by comparing changes across two branches
2 parents cf1c5b0 + 64d1978 commit e13a2e7

647 files changed

Lines changed: 14084 additions & 3756 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24881,7 +24881,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2488124881

2488224882
function discriminateTypeByDiscriminableItems(target: UnionType, discriminators: (readonly [() => Type, __String])[], related: (source: Type, target: Type) => boolean | Ternary) {
2488324883
const types = target.types;
24884-
const include: Ternary[] = types.map(t => t.flags & TypeFlags.Primitive ? Ternary.False : Ternary.True);
24884+
const include: Ternary[] = types.map(t => t.flags & TypeFlags.Primitive || getReducedType(t).flags & TypeFlags.Never ? Ternary.False : Ternary.True);
2488524885
for (const [getDiscriminatingType, propertyName] of discriminators) {
2488624886
// If the remaining target types include at least one with a matching discriminant, eliminate those that
2488724887
// have non-matching discriminants. This ensures that we ignore erroneous discriminators and gradually

src/compiler/program.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4484,7 +4484,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
44844484
createDeprecatedDiagnostic("charset");
44854485
}
44864486
if (options.out) {
4487-
createDeprecatedDiagnostic("out", /*value*/ undefined, "outFile");
4487+
createDeprecatedDiagnostic("out");
44884488
}
44894489
if (options.importsNotUsedAsValues) {
44904490
createDeprecatedDiagnostic("importsNotUsedAsValues", /*value*/ undefined, "verbatimModuleSyntax");
@@ -4510,6 +4510,9 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
45104510
if (options.allowSyntheticDefaultImports === false) {
45114511
createDeprecatedDiagnostic("allowSyntheticDefaultImports", "false", /*useInstead*/ undefined, /*related*/ undefined);
45124512
}
4513+
if (options.outFile) {
4514+
createDeprecatedDiagnostic("outFile");
4515+
}
45134516
if (options.module === ModuleKind.None || options.module === ModuleKind.AMD || options.module === ModuleKind.UMD || options.module === ModuleKind.System) {
45144517
createDeprecatedDiagnostic("module", ModuleKind[options.module], /*useInstead*/ undefined, /*related*/ undefined);
45154518
}

tests/baselines/reference/2dArrays.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ class Cell {
55
}
66

77
class Ship {
8-
isSunk: boolean;
8+
isSunk: boolean = false;
99
}
1010

1111
class Board {
12-
ships: Ship[];
13-
cells: Cell[];
12+
ships: Ship[] = [];
13+
cells: Cell[] = [];
1414

1515
private allShipsSunk() {
1616
return this.ships.every(function (val) { return val.isSunk; });
@@ -25,11 +25,14 @@ var Cell = /** @class */ (function () {
2525
}());
2626
var Ship = /** @class */ (function () {
2727
function Ship() {
28+
this.isSunk = false;
2829
}
2930
return Ship;
3031
}());
3132
var Board = /** @class */ (function () {
3233
function Board() {
34+
this.ships = [];
35+
this.cells = [];
3336
}
3437
Board.prototype.allShipsSunk = function () {
3538
return this.ships.every(function (val) { return val.isSunk; });

tests/baselines/reference/2dArrays.symbols

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ class Cell {
88
class Ship {
99
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))
1010

11-
isSunk: boolean;
11+
isSunk: boolean = false;
1212
>isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))
1313
}
1414

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

18-
ships: Ship[];
18+
ships: Ship[] = [];
1919
>ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13))
2020
>Ship : Symbol(Ship, Decl(2dArrays.ts, 1, 1))
2121

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

2626
private allShipsSunk() {
27-
>allShipsSunk : Symbol(Board.allShipsSunk, Decl(2dArrays.ts, 9, 18))
27+
>allShipsSunk : Symbol(Board.allShipsSunk, Decl(2dArrays.ts, 9, 23))
2828

2929
return this.ships.every(function (val) { return val.isSunk; });
3030
>this.ships.every : Symbol(Array.every, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

tests/baselines/reference/2dArrays.types

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@ class Ship {
1010
>Ship : Ship
1111
> : ^^^^
1212

13-
isSunk: boolean;
13+
isSunk: boolean = false;
1414
>isSunk : boolean
1515
> : ^^^^^^^
16+
>false : false
17+
> : ^^^^^
1618
}
1719

1820
class Board {
1921
>Board : Board
2022
> : ^^^^^
2123

22-
ships: Ship[];
24+
ships: Ship[] = [];
2325
>ships : Ship[]
2426
> : ^^^^^^
27+
>[] : undefined[]
28+
> : ^^^^^^^^^^^
2529

26-
cells: Cell[];
30+
cells: Cell[] = [];
2731
>cells : Cell[]
2832
> : ^^^^^^
33+
>[] : undefined[]
34+
> : ^^^^^^^^^^^
2935

3036
private allShipsSunk() {
3137
>allShipsSunk : () => boolean

tests/baselines/reference/APISample_Watch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function watchMain() {
5151
// You can technically override any given hook on the host, though you probably don't need to.
5252
// Note that we're assuming `origCreateProgram` and `origPostProgramCreate` doesn't use `this` at all.
5353
const origCreateProgram = host.createProgram;
54-
host.createProgram = (rootNames: ReadonlyArray<string>, options, host, oldProgram) => {
54+
host.createProgram = (rootNames: ReadonlyArray<string> | undefined, options, host, oldProgram) => {
5555
console.log("** We're about to create the program! **");
5656
return origCreateProgram(rootNames, options, host, oldProgram);
5757
}

tests/baselines/reference/abstractPropertyBasics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class C extends B {
1919
set prop(v) { }
2020
raw = "edge";
2121
readonly ro = "readonly please";
22-
readonlyProp: string; // don't have to give a value, in fact
22+
readonlyProp!: string;
2323
m() { }
2424
}
2525

tests/baselines/reference/abstractPropertyBasics.symbols

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class C extends B {
5353
readonly ro = "readonly please";
5454
>ro : Symbol(C.ro, Decl(abstractPropertyBasics.ts, 16, 17))
5555

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

5959
m() { }
60-
>m : Symbol(C.m, Decl(abstractPropertyBasics.ts, 18, 25))
60+
>m : Symbol(C.m, Decl(abstractPropertyBasics.ts, 18, 26))
6161
}

tests/baselines/reference/abstractPropertyBasics.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class C extends B {
7474
>"readonly please" : "readonly please"
7575
> : ^^^^^^^^^^^^^^^^^
7676

77-
readonlyProp: string; // don't have to give a value, in fact
77+
readonlyProp!: string;
7878
>readonlyProp : string
7979
> : ^^^^^^
8080

tests/baselines/reference/alwaysStrictModule2.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
12
a.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
23
b.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
34

45

6+
!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
57
==== a.ts (1 errors) ====
68
namespace M {
79
export function f() {

0 commit comments

Comments
 (0)