diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 66742c94f057e..664fe44caf95e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -38003,7 +38003,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const exprType = checkExpression(expression, checkMode); if (isConstTypeReference(type)) { if (!isValidConstAssertionArgument(expression)) { - error(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); + error(expression, Diagnostics.A_const_assertion_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); } return getRegularTypeOfLiteralType(exprType); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 22ac200a0dcee..af0881786459a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1155,7 +1155,7 @@ "category": "Error", "code": 1354 }, - "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals.": { + "A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals.": { "category": "Error", "code": 1355 }, diff --git a/tests/baselines/reference/constAssertions.errors.txt b/tests/baselines/reference/constAssertions.errors.txt index 99db0753d705f..d86f75c5906eb 100644 --- a/tests/baselines/reference/constAssertions.errors.txt +++ b/tests/baselines/reference/constAssertions.errors.txt @@ -1,7 +1,7 @@ constAssertions.ts(44,32): error TS2540: Cannot assign to 'x' because it is a read-only property. -constAssertions.ts(61,10): error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. -constAssertions.ts(62,10): error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. -constAssertions.ts(63,10): error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. +constAssertions.ts(61,10): error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. +constAssertions.ts(62,10): error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. +constAssertions.ts(63,10): error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. constAssertions.ts(118,3): error TS2322: Type '3' is not assignable to type '2'. @@ -70,13 +70,13 @@ constAssertions.ts(118,3): error TS2322: Type '3' is not assignable to type '2'. let e1 = v1 as const; // Error ~~ -!!! error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. +!!! error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. let e2 = (true ? 1 : 0) as const; // Error ~~~~~~~~~~~~~~ -!!! error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. +!!! error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. let e3 = id(1) as const; // Error ~~~~~ -!!! error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. +!!! error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. let t1 = 'foo' as const; let t2 = 'bar' as const; diff --git a/tests/baselines/reference/constantEnumAssert.errors.txt b/tests/baselines/reference/constantEnumAssert.errors.txt index 48c3188974673..de8943cd7f2b1 100644 --- a/tests/baselines/reference/constantEnumAssert.errors.txt +++ b/tests/baselines/reference/constantEnumAssert.errors.txt @@ -1,4 +1,4 @@ -constantEnumAssert.ts(49,20): error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. +constantEnumAssert.ts(49,20): error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. ==== constantEnumAssert.ts (1 errors) ==== @@ -52,5 +52,5 @@ constantEnumAssert.ts(49,20): error TS1355: A 'const' assertions can only be app const foo12 = { a: E5.a as const } ~~~~ -!!! error TS1355: A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals. +!!! error TS1355: A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals. \ No newline at end of file