Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4721,6 +4721,10 @@
"category": "Error",
"code": 5110
},
"Visit https://aka.ms/ts6 for migration information.": {
"category": "Message",
"code": 5111
},

"Generates a sourcemap for each corresponding '.d.ts' file.": {
"category": "Message",
Expand Down
35 changes: 23 additions & 12 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4446,8 +4446,8 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
function checkDeprecations(
deprecatedIn: 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,
createDiagnostic: (name: string, value: string | undefined, useInstead: string | undefined, related: DiagnosticMessage | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) => void,
fn: (createDeprecatedDiagnostic: (name: string, value?: string, useInstead?: string, related?: DiagnosticMessage) => void) => void,
) {
const deprecatedInVersion = new Version(deprecatedIn);
const removedInVersion = new Version(removedIn);
Expand All @@ -4458,36 +4458,44 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === Comparison.LessThan;

if (mustBeRemoved || canBeSilenced) {
fn((name, value, useInstead) => {
fn((name, value, useInstead, related) => {
if (mustBeRemoved) {
if (value === undefined) {
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
}
else {
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
}
}
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, related, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, 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, related, 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);
}
}
});
}
}

function verifyDeprecatedCompilerOptions() {
function createDiagnostic(name: string, value: string | undefined, useInstead: string | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
function createDiagnostic(name: string, value: string | undefined, useInstead: string | undefined, related: DiagnosticMessage | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
if (useInstead) {
const details = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Use_0_instead, useInstead);
let details = chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Use_0_instead, useInstead);
if (related) {
details = chainDiagnosticMessages(details, related);
}
const chain = chainDiagnosticMessages(details, message, ...args);
createDiagnosticForOption(/*onKey*/ !value, name, /*option2*/ undefined, chain);
}
else {
createDiagnosticForOption(/*onKey*/ !value, name, /*option2*/ undefined, message, ...args);
let details: DiagnosticMessageChain | undefined;
if (related) {
details = chainDiagnosticMessages(/*details*/ undefined, related);
}
const chain = chainDiagnosticMessages(details, message, ...args);
createDiagnosticForOption(/*onKey*/ !value, name, /*option2*/ undefined, chain);
}
}

Expand Down Expand Up @@ -4526,13 +4534,16 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro

checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
if (options.moduleResolution === ModuleResolutionKind.Node10) {
createDeprecatedDiagnostic("moduleResolution", "node10");
createDeprecatedDiagnostic("moduleResolution", "node10", /*useInstead*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information);
}
if (options.baseUrl !== undefined) {
createDeprecatedDiagnostic("baseUrl", /*value*/ undefined, /*useInstead*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information);
}
});
}

function verifyDeprecatedProjectReference(ref: ProjectReference, parentFile: JsonSourceFile | undefined, index: number) {
function createDiagnostic(_name: string, _value: string | undefined, _useInstead: string | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
function createDiagnostic(_name: string, _value: string | undefined, _useInstead: string | undefined, _related: DiagnosticMessage | undefined, message: DiagnosticMessage, ...args: DiagnosticArguments) {
createDiagnosticForReference(parentFile, index, message, ...args);
}

Expand Down
1 change: 1 addition & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7410,6 +7410,7 @@ export interface CompilerOptions {
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean; // Always combine with strict property
/** @deprecated */
baseUrl?: string;
/**
* An error if set - this should only go through the -b pipeline and not actually be observed
Expand Down
19 changes: 19 additions & 0 deletions tests/baselines/reference/amdModuleConstEnumUsage.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
Visit https://aka.ms/ts6 for migration information.


!!! error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5101: Visit https://aka.ms/ts6 for migration information.
==== /proj/defs/cc.ts (0 errors) ====
export const enum CharCode {
A,
B
}
==== /proj/component/file.ts (0 errors) ====
import { CharCode } from 'defs/cc';
export class User {
method(input: number) {
if (CharCode.A === input) {}
}
}

1 change: 1 addition & 0 deletions tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7024,6 +7024,7 @@ declare namespace ts {
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean;
/** @deprecated */
baseUrl?: string;
/** @deprecated */
charset?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/tsconfig.json(6,5): error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
Visit https://aka.ms/ts6 for migration information.


==== /tsconfig.json (1 errors) ====
{
"compilerOptions": {
"module": "nodenext",
"declaration": true,
"outDir": "temp",
"baseUrl": "."
~~~~~~~~~
!!! error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5101: Visit https://aka.ms/ts6 for migration information.
}
}

==== /packages/compiler-core/src/index.ts (0 errors) ====
import { PluginConfig } from "@babel/parser";

==== /packages/compiler-sfc/src/index.ts (0 errors) ====
import { createPlugin } from "@babel/parser";
export function resolveParserPlugins() {
return [createPlugin()];
}

==== /node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/package.json (0 errors) ====
{
"name": "@babel/parser",
"version": "7.23.6",
"main": "./lib/index.js",
"types": "./typings/babel-parser.d.ts"
}

==== /node_modules/.pnpm/@[email protected]/node_modules/@babel/parser/typings/babel-parser.d.ts (0 errors) ====
export declare function createPlugin(): PluginConfig;
export declare class PluginConfig {}

==== /packages/compiler-core/package.json (0 errors) ====
{
"name": "@vue/compiler-core",
"version": "3.0.0",
"main": "./src/index.ts",
"dependencies": {
"@babel/parser": "^7.0.0"
}
}

==== /packages/compiler-sfc/package.json (0 errors) ====
{
"name": "@vue/compiler-sfc",
"version": "3.0.0",
"main": "./src/index.ts",
"dependencies": {
"@babel/parser": "^7.0.0",
"@vue/compiler-core": "^3.0.0"
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
packages/b/tsconfig.json(5,9): error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
Visit https://aka.ms/ts6 for migration information.


==== packages/b/tsconfig.json (1 errors) ====
{
"compilerOptions": {
"outDir": "dist",
"declaration": true,
"baseUrl": ".",
~~~~~~~~~
!!! error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5101: Visit https://aka.ms/ts6 for migration information.
"paths": {
"@ts-bug/a": ["../a"]
}
}
}


==== packages/b/src/index.ts (0 errors) ====
import { a } from "@ts-bug/a";

export function b(text: string) {
return a(text);
}
==== packages/a/index.d.ts (0 errors) ====
declare module "@ts-bug/a" {
export type AText = {
value: string;
};
export function a(text: string): AText;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
packages/lab/tsconfig.json(5,9): error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
Visit https://aka.ms/ts6 for migration information.


==== packages/lab/tsconfig.json (1 errors) ====
{
"compilerOptions": {
"outDir": "dist",
"declaration": true,
"baseUrl": "../",
~~~~~~~~~
!!! error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5101: Visit https://aka.ms/ts6 for migration information.
"paths": {
"@ts-bug/core": ["./core/src"],
"@ts-bug/core/*": ["./core/src/*"],
"@ts-bug/lab": ["./lab/src"],
"@ts-bug/lab/*": ["./lab/src/*"],
"@ts-bug/styles": ["./styles/src"],
"@ts-bug/styles/*": ["./styles/src/*"]
}
}
}
==== packages/lab/src/index.ts (0 errors) ====
import { createSvgIcon } from "@ts-bug/core/utils";
export default createSvgIcon("Hello", "ArrowLeft");

==== packages/core/src/index.d.ts (0 errors) ====
export * from "./utils";
export { default as SvgIcon } from "./SvgIcon";

==== packages/core/src/SvgIcon.d.ts (0 errors) ====
import { StyledComponentProps } from "@ts-bug/styles";
export interface SvgIconProps extends StyledComponentProps<"root"> {
children?: string[];
}
export interface SomeInterface {
myProp: string;
}
declare const SvgIcon: SomeInterface;
export default SvgIcon;

==== packages/core/src/utils.d.ts (0 errors) ====
import SvgIcon from "./SvgIcon";
export function createSvgIcon(path: string, displayName: string): typeof SvgIcon;

==== packages/styles/src/index.d.ts (0 errors) ====
export interface StyledComponentProps<ClassKey extends string> {
classes?: Record<ClassKey, string>;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
Visit https://aka.ms/ts6 for migration information.


!!! error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5101: Visit https://aka.ms/ts6 for migration information.
==== src/lib/operators/scalar.ts (0 errors) ====
export interface Scalar {
(): string;
value: number;
}

export function scalar(value: string): Scalar {
return null as any;
}
==== src/settings/spacing.ts (0 errors) ====
import { scalar } from '../lib/operators/scalar';

export default {
get xs() {
return scalar("14px");
}
};

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function scalar(value: string): Scalar {

return null as any;
>null as any : any
> : ^^^
}
=== src/settings/spacing.ts ===
import { scalar } from '../lib/operators/scalar';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
Visit https://aka.ms/ts6 for migration information.


!!! error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
!!! error TS5101: Visit https://aka.ms/ts6 for migration information.
==== src/lib/operators/scalar.ts (0 errors) ====
export interface Scalar {
(): string;
value: number;
}

export function scalar(value: string): Scalar {
return null as any;
}
==== src/settings/spacing.ts (0 errors) ====
import { scalar } from '../lib/operators/scalar';

export default {
get xs() {
return scalar("14px");
}
};

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function scalar(value: string): Scalar {

return null as any;
>null as any : any
> : ^^^
}
=== src/settings/spacing.ts ===
import { scalar } from '../lib/operators/scalar';
Expand Down
Loading