From 44331b9fa32999d4aade7433c10cd3ec8596957e Mon Sep 17 00:00:00 2001 From: Joost Koehoorn Date: Mon, 7 Oct 2024 20:12:47 +0200 Subject: [PATCH] Fix grammar issue in TS9025 diagnostic message (#60136) --- src/compiler/diagnosticMessages.json | 2 +- .../transformers/declarations/diagnostics.ts | 2 +- .../fixMissingTypeAnnotationOnExports.ts | 2 +- .../declarationFunctionDeclarations.d.ts | 36 +++++++++---------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index cab78bae9e0..7f686076f18 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -7058,7 +7058,7 @@ "category": "Error", "code": 9023 }, - "Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations.": { + "Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations.": { "category": "Error", "code": 9025 }, diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index ccd95b06651..84e952da136 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -772,7 +772,7 @@ export function createGetIsolatedDeclarationErrors(resolver: EmitResolver): (nod return createExpressionError(node.initializer); } const message = addUndefined ? - Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations : + Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind]; const diag = createDiagnosticForNode(node, message); const targetStr = getTextOfNode(node.name, /*includeTrivia*/ false); diff --git a/src/services/codefixes/fixMissingTypeAnnotationOnExports.ts b/src/services/codefixes/fixMissingTypeAnnotationOnExports.ts index 3a76444aa82..a82ccb01f00 100644 --- a/src/services/codefixes/fixMissingTypeAnnotationOnExports.ts +++ b/src/services/codefixes/fixMissingTypeAnnotationOnExports.ts @@ -135,7 +135,7 @@ const errorCodes = [ Diagnostics.Default_exports_can_t_be_inferred_with_isolatedDeclarations.code, Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations.code, Diagnostics.Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function.code, - Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations.code, + Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations.code, Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations.code, Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit.code, ]; diff --git a/tests/baselines/reference/transpile/declarationFunctionDeclarations.d.ts b/tests/baselines/reference/transpile/declarationFunctionDeclarations.d.ts index 660699a4426..7814e7759fa 100644 --- a/tests/baselines/reference/transpile/declarationFunctionDeclarations.d.ts +++ b/tests/baselines/reference/transpile/declarationFunctionDeclarations.d.ts @@ -125,15 +125,15 @@ export {}; //// [Diagnostics reported] -fnDecl.ts(12,27): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(16,36): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(20,26): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(24,56): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(28,46): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(32,45): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(37,47): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(41,37): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. -fnDecl.ts(45,35): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +fnDecl.ts(12,27): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(16,36): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(20,26): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(24,56): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(28,46): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(32,45): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(37,47): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(41,37): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. +fnDecl.ts(45,35): error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. ==== fnDecl.ts (9 errors) ==== @@ -150,42 +150,42 @@ fnDecl.ts(45,35): error TS9025: Declaration emit for this parameter requires imp export function fnDeclHasUndefined(p: T | undefined = [], rParam: string): void { }; export function fnDeclBad(p: T = [], rParam: string): void { }; ~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:12:27: Add a type annotation to the parameter p. export const fnExprOk1 = function (array: number[] = [], rParam: string): void { }; export const fnExprOk2 = function (array: T | undefined = [], rParam: string): void { }; export const fnExprBad = function (array: T = [], rParam: string): void { }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:16:36: Add a type annotation to the parameter array. export const arrowOk1 = (array: number[] = [], rParam: string): void => { }; export const arrowOk2 = (array: T | undefined = [], rParam: string): void => { }; export const arrowBad = (array: T = [], rParam: string): void => { }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:20:26: Add a type annotation to the parameter array. export const inObjectLiteralFnExprOk1 = { o: function (array: number[] = [], rParam: string): void { } }; export const inObjectLiteralFnExprOk2 = { o: function (array: T | undefined = [], rParam: string): void { } }; export const inObjectLiteralFnExprBad = { o: function (array: T = [], rParam: string): void { } }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:24:56: Add a type annotation to the parameter array. export const inObjectLiteralArrowOk1 = { o: (array: number[] = [], rParam: string): void => { } }; export const inObjectLiteralArrowOk2 = { o: (array: T | undefined = [], rParam: string): void => { } }; export const inObjectLiteralArrowBad = { o: (array: T = [], rParam: string): void => { } }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:28:46: Add a type annotation to the parameter array. export const inObjectLiteralMethodOk1 = { o(array: number[] = [], rParam: string): void { } }; export const inObjectLiteralMethodOk2 = { o(array: T | undefined = [], rParam: string): void { } }; export const inObjectLiteralMethodBad = { o(array: T = [], rParam: string): void { } }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:32:45: Add a type annotation to the parameter array. @@ -193,21 +193,21 @@ fnDecl.ts(45,35): error TS9025: Declaration emit for this parameter requires imp export class InClassFnExprOk2 { o = function (array: T | undefined = [], rParam: string): void { } }; export class InClassFnExprBad { o = function (array: T = [], rParam: string): void { } }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:37:47: Add a type annotation to the parameter array. export class InClassArrowOk1 { o = (array: number[] = [], rParam: string): void => { } }; export class InClassArrowOk2 { o = (array: T | undefined = [], rParam: string): void => { } }; export class InClassArrowBad { o = (array: T = [], rParam: string): void => { } }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:41:37: Add a type annotation to the parameter array. export class InClassMethodOk1 { o(array: number[] = [], rParam: string): void { } }; export class InClassMethodOk2 { o(array: T | undefined = [], rParam: string): void { } }; export class InClassMethodBad { o(array: T = [], rParam: string): void { } }; ~~~~~~~~~~~~~ -!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations. +!!! error TS9025: Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations. !!! related TS9028 fnDecl.ts:45:35: Add a type annotation to the parameter array.