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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24881,7 +24881,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {

function discriminateTypeByDiscriminableItems(target: UnionType, discriminators: (readonly [() => Type, __String])[], related: (source: Type, target: Type) => boolean | Ternary) {
const types = target.types;
const include: Ternary[] = types.map(t => t.flags & TypeFlags.Primitive ? Ternary.False : Ternary.True);
const include: Ternary[] = types.map(t => t.flags & TypeFlags.Primitive || getReducedType(t).flags & TypeFlags.Never ? Ternary.False : Ternary.True);
for (const [getDiscriminatingType, propertyName] of discriminators) {
// If the remaining target types include at least one with a matching discriminant, eliminate those that
// have non-matching discriminants. This ensures that we ignore erroneous discriminators and gradually
Expand Down
5 changes: 4 additions & 1 deletion src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4484,7 +4484,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
createDeprecatedDiagnostic("charset");
}
if (options.out) {
createDeprecatedDiagnostic("out", /*value*/ undefined, "outFile");
createDeprecatedDiagnostic("out");
}
if (options.importsNotUsedAsValues) {
createDeprecatedDiagnostic("importsNotUsedAsValues", /*value*/ undefined, "verbatimModuleSyntax");
Expand All @@ -4510,6 +4510,9 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
if (options.allowSyntheticDefaultImports === false) {
createDeprecatedDiagnostic("allowSyntheticDefaultImports", "false", /*useInstead*/ undefined, /*related*/ undefined);
}
if (options.outFile) {
createDeprecatedDiagnostic("outFile");
}
if (options.module === ModuleKind.None || options.module === ModuleKind.AMD || options.module === ModuleKind.UMD || options.module === ModuleKind.System) {
createDeprecatedDiagnostic("module", ModuleKind[options.module], /*useInstead*/ undefined, /*related*/ undefined);
}
Expand Down
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
2 changes: 2 additions & 0 deletions tests/baselines/reference/alwaysStrictModule2.errors.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
a.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
b.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== a.ts (1 errors) ====
namespace M {
export function f() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== Class.ts (0 errors) ====
import { Configurable } from "./Configurable"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== file1.ts (0 errors) ====
/// <amd-module name="mynamespace::SomeModuleA" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== c.ts (0 errors) ====
let foo: typeof C;
==== b.ts (0 errors) ====
class C { }

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== test.ts (0 errors) ====
namespace C {
Expand Down
30 changes: 30 additions & 0 deletions tests/baselines/reference/bundledDtsLateExportRenaming.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== index.ts (0 errors) ====
export * from "./nested";

==== nested/base.ts (0 errors) ====
import { B } from "./shared";

export function f() {
return new B();
}

==== nested/derived.ts (0 errors) ====
import { f } from "./base";

export function g() {
return f();
}

==== nested/index.ts (0 errors) ====
export * from "./base";

export * from "./derived";
export * from "./shared";

==== nested/shared.ts (0 errors) ====
export class B {}

31 changes: 0 additions & 31 deletions tests/baselines/reference/bundledDtsLateExportRenaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,3 @@ declare module "nested/index" {
declare module "index" {
export * from "nested/index";
}


//// [DtsFileErrors]


dist/out.d.ts(10,33): error TS2307: Cannot find module 'nested' or its corresponding type declarations.


==== dist/out.d.ts (1 errors) ====
declare module "nested/shared" {
export class B {
}
}
declare module "nested/base" {
import { B } from "nested/shared";
export function f(): B;
}
declare module "nested/derived" {
export function g(): import("nested").B;
~~~~~~~~
!!! error TS2307: Cannot find module 'nested' or its corresponding type declarations.
}
declare module "nested/index" {
export * from "nested/base";
export * from "nested/derived";
export * from "nested/shared";
}
declare module "index" {
export * from "nested/index";
}

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
weird.js(1,1): error TS2552: Cannot find name 'someFunction'. Did you mean 'Function'?
weird.js(1,23): error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
weird.js(9,17): error TS7006: Parameter 'error' implicitly has an 'any' type.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== weird.js (3 errors) ====
someFunction(function(BaseClass) {
~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/checkJsdocOnEndOfFile.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
eof.js(2,20): error TS2304: Cannot find name 'bad'.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== eof.js (1 errors) ====
/**
* @typedef {Array<bad>} Should have error here
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/checkJsdocReturnTag1.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
returns.js(20,12): error TS2872: This kind of expression is always truthy.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== returns.js (1 errors) ====
// @ts-check
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/checkJsdocReturnTag2.errors.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
returns.js(6,5): error TS2322: Type 'number' is not assignable to type 'string'.
returns.js(13,5): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
Type 'boolean' is not assignable to type 'string | number'.
returns.js(13,12): error TS2872: This kind of expression is always truthy.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== returns.js (3 errors) ====
// @ts-check
/**
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/commonSourceDir5.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile.
==== A:/bar.ts (0 errors) ====
import {z} from "./foo";
Expand Down
2 changes: 2 additions & 0 deletions tests/baselines/reference/commonSourceDir6.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5107: Option 'module=AMD' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== a/bar.ts (0 errors) ====
import {z} from "./foo";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== a.ts (0 errors) ====
class c {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== a.ts (0 errors) ====
class c {
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== computedPropertyNames52.js (0 errors) ====
const array = [];
for (let i = 0; i < 10; ++i) {
array.push(class C {
[i] = () => C;
static [i] = 100;
})
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== computedPropertyNames52.js (0 errors) ====
const array = [];
for (let i = 0; i < 10; ++i) {
array.push(class C {
[i] = () => C;
static [i] = 100;
})
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
file1.ts(1,1): error TS2448: Block-scoped variable 'c' used before its declaration.


!!! error TS5101: Option 'outFile' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
==== file1.ts (1 errors) ====
c;
~
Expand Down
Loading
Loading