Skip to content

Commit

Permalink
5.5 deprecations are no-ops, not errors (#58313)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanCavanaugh committed Apr 25, 2024
1 parent 0c2fd6d commit ecf3789
Show file tree
Hide file tree
Showing 52 changed files with 138 additions and 187 deletions.
9 changes: 5 additions & 4 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4569,6 +4569,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg

function checkDeprecations(
deprecatedIn: string,
stopsWorkingIn: string,
removedIn: string,
createDiagnostic: (name: string, value: string | undefined, useInstead: string | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) => void,
fn: (createDeprecatedDiagnostic: (name: string, value?: string, useInstead?: string) => void) => void,
Expand All @@ -4593,10 +4594,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
}
else {
if (value === undefined) {
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, stopsWorkingIn, deprecatedIn);
}
else {
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, stopsWorkingIn, deprecatedIn);
}
}
});
Expand All @@ -4615,7 +4616,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
}
}

checkDeprecations("5.0", "5.5", createDiagnostic, createDeprecatedDiagnostic => {
checkDeprecations("5.0", "5.5", "6.0", createDiagnostic, createDeprecatedDiagnostic => {
if (options.target === ScriptTarget.ES3) {
createDeprecatedDiagnostic("target", "ES3");
}
Expand Down Expand Up @@ -4654,7 +4655,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
createDiagnosticForReference(parentFile, index, message, ...args);
}

checkDeprecations("5.0", "5.5", createDiagnostic, createDeprecatedDiagnostic => {
checkDeprecations("5.0", "5.5", "6.0", createDiagnostic, createDeprecatedDiagnostic => {
if (ref.prepend) {
createDeprecatedDiagnostic("prepend");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
alwaysStrictNoImplicitUseStrict.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.


!!! error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== alwaysStrictNoImplicitUseStrict.ts (1 errors) ====
module M {
export function f() {
Expand Down
46 changes: 0 additions & 46 deletions tests/baselines/reference/deprecatedCompilerOptions4.errors.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error TS5102: Option 'suppressExcessPropertyErrors' has been removed. Please remove it from your configuration.
error TS5101: Option 'suppressExcessPropertyErrors' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
excessPropertyErrorsSuppressed.ts(1,38): error TS2353: Object literal may only specify known properties, and 'b' does not exist in type '{ a: string; }'.


!!! error TS5102: Option 'suppressExcessPropertyErrors' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'suppressExcessPropertyErrors' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== excessPropertyErrorsSuppressed.ts (1 errors) ====
var x: { a: string } = { a: "hello", b: 42 }; // No error
~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error TS5102: Option 'importsNotUsedAsValues' has been removed. Please remove it from your configuration.
error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
Use 'verbatimModuleSyntax' instead.
/e.ts(1,1): error TS6192: All imports in import declaration are unused.


!!! error TS5102: Option 'importsNotUsedAsValues' has been removed. Please remove it from your configuration.
!!! error TS5102: Use 'verbatimModuleSyntax' instead.
!!! error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
!!! error TS5101: Use 'verbatimModuleSyntax' instead.
==== /a.ts (0 errors) ====
export default class {}
export class A {}
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/isolatedModulesOut.errors.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
error TS5102: Option 'out' has been removed. Please remove it from your configuration.
error TS5101: Option 'out' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
Use 'outFile' instead.


!!! error TS5102: Option 'out' has been removed. Please remove it from your configuration.
!!! error TS5102: Use 'outFile' instead.
!!! error TS5101: Option 'out' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
!!! error TS5101: Use 'outFile' instead.
==== file1.ts (0 errors) ====
export var x;
==== file2.ts (0 errors) ====
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error TS5102: Option 'keyofStringsOnly' has been removed. Please remove it from your configuration.
error TS5101: Option 'keyofStringsOnly' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
keyofDoesntContainSymbols.ts(11,30): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.


!!! error TS5102: Option 'keyofStringsOnly' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'keyofStringsOnly' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== keyofDoesntContainSymbols.ts (1 errors) ====
const sym = Symbol();
const num = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error TS5102: Option 'keyofStringsOnly' has been removed. Please remove it from your configuration.
error TS5101: Option 'keyofStringsOnly' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5102: Option 'keyofStringsOnly' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'keyofStringsOnly' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== lateBoundConstraintTypeChecksCorrectly.ts (0 errors) ====
declare const fooProp: unique symbol;
declare const barProp: unique symbol;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error TS5102: Option 'keyofStringsOnly' has been removed. Please remove it from your configuration.
error TS5101: Option 'keyofStringsOnly' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5102: Option 'keyofStringsOnly' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'keyofStringsOnly' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== mappedTypeUnionConstraintInferences.ts (0 errors) ====
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export declare type PartialProperties<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
error TS5102: Option 'importsNotUsedAsValues' has been removed. Please remove it from your configuration.
Use 'verbatimModuleSyntax' instead.
file.ts(1,1): error TS1287: A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled.
index.ts(1,9): error TS1286: ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.


!!! error TS5102: Option 'importsNotUsedAsValues' has been removed. Please remove it from your configuration.
!!! error TS5102: Use 'verbatimModuleSyntax' instead.
==== file.ts (1 errors) ====
export class A {}
~~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error TS5102: Option 'suppressImplicitAnyIndexErrors' has been removed. Please remove it from your configuration.
error TS5101: Option 'suppressImplicitAnyIndexErrors' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
noImplicitAnyIndexingSuppressed.ts(12,37): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
noImplicitAnyIndexingSuppressed.ts(19,9): error TS2339: Property 'hi' does not exist on type '{}'.
noImplicitAnyIndexingSuppressed.ts(22,9): error TS2339: Property '10' does not exist on type '{}'.
noImplicitAnyIndexingSuppressed.ts(29,10): error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}'.


!!! error TS5102: Option 'suppressImplicitAnyIndexErrors' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'suppressImplicitAnyIndexErrors' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== noImplicitAnyIndexingSuppressed.ts (4 errors) ====
enum MyEmusEnum {
emu
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/noImplicitUseStrict_amd.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== noImplicitUseStrict_amd.ts (0 errors) ====
export var x = 0;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== noImplicitUseStrict_commonjs.ts (0 errors) ====
export var x = 0;
4 changes: 2 additions & 2 deletions tests/baselines/reference/noImplicitUseStrict_es6.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== noImplicitUseStrict_es6.ts (0 errors) ====
export var x = 0;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== noImplicitUseStrict_system.ts (0 errors) ====
export var x = 0;
4 changes: 2 additions & 2 deletions tests/baselines/reference/noImplicitUseStrict_umd.errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.


!!! error TS5102: Option 'noImplicitUseStrict' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'noImplicitUseStrict' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== noImplicitUseStrict_umd.ts (0 errors) ====
export var x = 0;
4 changes: 2 additions & 2 deletions tests/baselines/reference/noStrictGenericChecks.errors.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error TS5102: Option 'noStrictGenericChecks' has been removed. Please remove it from your configuration.
error TS5101: Option 'noStrictGenericChecks' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
noStrictGenericChecks.ts(5,5): error TS2322: Type 'B' is not assignable to type 'A'.
Types of parameters 'y' and 'y' are incompatible.
Type 'U' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.


!!! error TS5102: Option 'noStrictGenericChecks' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'noStrictGenericChecks' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== noStrictGenericChecks.ts (1 errors) ====
type A = <T, U>(x: T, y: U) => [T, U];
type B = <S>(x: S, y: S) => [S, S];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
error TS5102: Option 'suppressImplicitAnyIndexErrors' has been removed. Please remove it from your configuration.
error TS5101: Option 'suppressImplicitAnyIndexErrors' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
nonPrimitiveIndexingWithForInSupressError.ts(4,17): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.


!!! error TS5102: Option 'suppressImplicitAnyIndexErrors' has been removed. Please remove it from your configuration.
!!! error TS5101: Option 'suppressImplicitAnyIndexErrors' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
==== nonPrimitiveIndexingWithForInSupressError.ts (1 errors) ====
var a: object;

Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/preserveUnusedImports.errors.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
error TS5102: Option 'importsNotUsedAsValues' has been removed. Please remove it from your configuration.
error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
Use 'verbatimModuleSyntax' instead.


!!! error TS5102: Option 'importsNotUsedAsValues' has been removed. Please remove it from your configuration.
!!! error TS5102: Use 'verbatimModuleSyntax' instead.
!!! error TS5101: Option 'importsNotUsedAsValues' is deprecated and will stop functioning in TypeScript 5.5. Specify compilerOption '"ignoreDeprecations": "5.0"' to silence this error.
!!! error TS5101: Use 'verbatimModuleSyntax' instead.
==== a.ts (0 errors) ====
export type A = {};

Expand Down

0 comments on commit ecf3789

Please sign in to comment.