mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
update diagnostic text
This commit is contained in:
1 parent
79ef4fd0b0
commit
69b8a58ca1
3 files changed
+39
-35
No files matched your search
+12
-8
@@ -1028,7 +1028,7 @@ namespace ts {
|
||||
const potentialReflectCollisions: Node[] = [];
|
||||
const potentialAlwaysCheckedUnusedTypes: {
|
||||
node: Node;
|
||||
name: BindingName;
|
||||
name: Identifier;
|
||||
diagnostic: DiagnosticMessage;
|
||||
}[] = [];
|
||||
const awaitedTypeStack: number[] = [];
|
||||
@@ -37579,6 +37579,14 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
function checkPotentialAlwaysCheckedUnusedTypes() {
|
||||
for (const { node, name, diagnostic } of potentialAlwaysCheckedUnusedTypes) {
|
||||
if (!(getSymbolOfNode(node)?.isReferenced! & SymbolFlags.Type)) {
|
||||
error(name, diagnostic, declarationNameToString(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bindingNameText(name: BindingName): string {
|
||||
switch (name.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
@@ -37933,7 +37941,7 @@ namespace ts {
|
||||
potentialAlwaysCheckedUnusedTypes.push({
|
||||
node,
|
||||
name: node.name,
|
||||
diagnostic: Diagnostics.Renaming_a_property_in_destructuring_assignment_is_only_allowed_in_a_function_or_constructor_implementation
|
||||
diagnostic: Diagnostics.Variable_0_is_not_used_Did_you_mean_to_write_a_type_annotation_for_whole_object
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -41801,12 +41809,8 @@ namespace ts {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!node.isDeclarationFile && potentialAlwaysCheckedUnusedTypes.length) {
|
||||
for (const { node, name, diagnostic } of potentialAlwaysCheckedUnusedTypes) {
|
||||
if (!(getSymbolOfNode(node)?.isReferenced! & SymbolFlags.Type)) {
|
||||
error(name, diagnostic);
|
||||
}
|
||||
}
|
||||
if (!node.isDeclarationFile) {
|
||||
checkPotentialAlwaysCheckedUnusedTypes();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3487,7 +3487,7 @@
|
||||
"category": "Error",
|
||||
"code": 2841
|
||||
},
|
||||
"Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.": {
|
||||
"Variable '{0}' is not used. Did you mean to write a type annotation for whole object?": {
|
||||
"category": "Error",
|
||||
"code": 2842
|
||||
},
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(3,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(4,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(5,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(6,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(8,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(13,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(14,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(15,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(16,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(18,17): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(24,16): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(27,9): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(30,13): error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(3,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(4,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(5,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(6,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(8,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(13,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(14,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(15,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(16,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(18,17): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(24,16): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(27,9): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(30,13): error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
|
||||
|
||||
==== tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts (13 errors) ====
|
||||
@@ -18,40 +18,40 @@ tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(30,13): error
|
||||
type F1 = (arg: number) => any; // OK
|
||||
type F2 = ({ a: string }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type F3 = ({ a: string, b, c }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type F4 = ({ a: string }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type F5 = ({ a: string, b, c }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type F6 = ({ a: string }) => typeof string; // OK
|
||||
type F7 = ({ a: string, b: number }) => typeof number; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type F8 = ({ a, b: number }) => typeof number; // OK
|
||||
type F9 = ([a, b, c]) => void; // Error
|
||||
|
||||
type G1 = (arg: number) => any; // OK
|
||||
type G2 = ({ a: string }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type G3 = ({ a: string, b, c }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type G4 = ({ a: string }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type G5 = ({ a: string, b, c }: O) => any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type G6 = ({ a: string }) => typeof string; // OK
|
||||
type G7 = ({ a: string, b: number }) => typeof number; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
type G8 = ({ a, b: number }) => typeof number; // OK
|
||||
type G9 = ([a, b, c]) => void; // Error
|
||||
|
||||
@@ -59,15 +59,15 @@ tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(30,13): error
|
||||
method1(arg: number): any; // OK
|
||||
method2({ a: string }): any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
|
||||
(arg: number): any; // OK
|
||||
({ a: string }): any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
|
||||
new (arg: number): any; // OK
|
||||
new ({ a: string }): any; // Error
|
||||
~~~~~~
|
||||
!!! error TS2842: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
|
||||
!!! error TS2842: Variable 'string' is not used. Did you mean to write a type annotation for whole object?
|
||||
}
|
||||
Reference in new issue
Block a user