mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
* some fixes for 41974 * linted * fixed todo messages for readability
This commit is contained in:
@@ -9896,7 +9896,12 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
type = errorType;
|
||||
error(isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
if (declaration.kind === SyntaxKind.JSDocEnumTag) {
|
||||
error(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
error(isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
links.declaredType = type;
|
||||
}
|
||||
@@ -32821,7 +32826,7 @@ namespace ts {
|
||||
function checkParenthesizedExpression(node: ParenthesizedExpression, checkMode?: CheckMode): Type {
|
||||
const tag = isInJSFile(node) ? getJSDocTypeTag(node) : undefined;
|
||||
if (tag) {
|
||||
return checkAssertionWorker(tag, tag.typeExpression.type, node.expression, checkMode);
|
||||
return checkAssertionWorker(tag.typeExpression.type, tag.typeExpression.type, node.expression, checkMode);
|
||||
}
|
||||
return checkExpression(node.expression, checkMode);
|
||||
}
|
||||
@@ -35065,12 +35070,14 @@ namespace ts {
|
||||
// Include the `<>` in the error message
|
||||
: rangeOfTypeParameters(sourceFile, parent.typeParameters!);
|
||||
const only = parent.typeParameters!.length === 1;
|
||||
//TODO: following line is possible reason for bug #41974, unusedTypeParameters_TemplateTag
|
||||
const message = only ? Diagnostics._0_is_declared_but_its_value_is_never_read : Diagnostics.All_type_parameters_are_unused;
|
||||
const arg0 = only ? name : undefined;
|
||||
addDiagnostic(typeParameter, UnusedKind.Parameter, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0));
|
||||
}
|
||||
}
|
||||
else {
|
||||
//TODO: following line is possible reason for bug #41974, unusedTypeParameters_TemplateTag
|
||||
addDiagnostic(typeParameter, UnusedKind.Parameter, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
tests/cases/conformance/jsdoc/bug27142.js(1,5): error TS2456: Type alias 'E' circularly references itself.
|
||||
tests/cases/conformance/jsdoc/bug27142.js(1,12): error TS2456: Type alias 'E' circularly references itself.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsdoc/bug27142.js (1 errors) ====
|
||||
/** @enum {E} */
|
||||
~~~~~~~~~~
|
||||
~
|
||||
!!! error TS2456: Type alias 'E' circularly references itself.
|
||||
const E = { x: 0 };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/Main.js(2,14): error TS2352: Conversion of type 'string' to type 'typeof _default' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/compiler/Main.js(2,21): error TS2352: Conversion of type 'string' to type 'typeof _default' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
|
||||
|
||||
==== tests/cases/compiler/GeometryType.d.ts (0 errors) ====
|
||||
@@ -12,7 +12,7 @@ tests/cases/compiler/Main.js(2,14): error TS2352: Conversion of type 'string' to
|
||||
==== tests/cases/compiler/Main.js (1 errors) ====
|
||||
export default function () {
|
||||
return /** @type {import('./GeometryType.js').default} */ ('Point');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Conversion of type 'string' to type 'typeof _default' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
tests/cases/conformance/jsdoc/b.js(4,13): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/conformance/jsdoc/b.js(45,16): error TS2352: Conversion of type 'SomeOther' to type 'SomeBase' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/conformance/jsdoc/b.js(4,20): error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/conformance/jsdoc/b.js(45,23): error TS2352: Conversion of type 'SomeOther' to type 'SomeBase' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
Property 'p' is missing in type 'SomeOther' but required in type 'SomeBase'.
|
||||
tests/cases/conformance/jsdoc/b.js(49,19): error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/conformance/jsdoc/b.js(49,26): error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
Type 'SomeOther' is missing the following properties from type 'SomeDerived': x, p
|
||||
tests/cases/conformance/jsdoc/b.js(51,17): error TS2352: Conversion of type 'SomeDerived' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/conformance/jsdoc/b.js(51,24): error TS2352: Conversion of type 'SomeDerived' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
Property 'q' is missing in type 'SomeDerived' but required in type 'SomeOther'.
|
||||
tests/cases/conformance/jsdoc/b.js(52,17): error TS2352: Conversion of type 'SomeBase' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
tests/cases/conformance/jsdoc/b.js(52,24): error TS2352: Conversion of type 'SomeBase' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
Property 'q' is missing in type 'SomeBase' but required in type 'SomeOther'.
|
||||
tests/cases/conformance/jsdoc/b.js(58,1): error TS2322: Type 'SomeFakeClass' is not assignable to type 'SomeBase'.
|
||||
Types of property 'p' are incompatible.
|
||||
@@ -26,7 +26,7 @@ tests/cases/conformance/jsdoc/b.js(67,8): error TS2454: Variable 'numOrStr' is u
|
||||
var W = /** @type {string} */(/** @type {*} */ (4));
|
||||
|
||||
var W = /** @type {string} */(4); // Error
|
||||
~~~~~~~~~~~~~~~
|
||||
~~~~~~
|
||||
!!! error TS2352: Conversion of type 'number' to type 'string' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
|
||||
/** @type {*} */
|
||||
@@ -69,7 +69,7 @@ tests/cases/conformance/jsdoc/b.js(67,8): error TS2454: Variable 'numOrStr' is u
|
||||
someBase = /** @type {SomeBase} */(someDerived);
|
||||
someBase = /** @type {SomeBase} */(someBase);
|
||||
someBase = /** @type {SomeBase} */(someOther); // Error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~
|
||||
!!! error TS2352: Conversion of type 'SomeOther' to type 'SomeBase' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
!!! error TS2352: Property 'p' is missing in type 'SomeOther' but required in type 'SomeBase'.
|
||||
!!! related TS2728 tests/cases/conformance/jsdoc/b.js:17:9: 'p' is declared here.
|
||||
@@ -77,17 +77,17 @@ tests/cases/conformance/jsdoc/b.js(67,8): error TS2454: Variable 'numOrStr' is u
|
||||
someDerived = /** @type {SomeDerived} */(someDerived);
|
||||
someDerived = /** @type {SomeDerived} */(someBase);
|
||||
someDerived = /** @type {SomeDerived} */(someOther); // Error
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2352: Conversion of type 'SomeOther' to type 'SomeDerived' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
!!! error TS2352: Type 'SomeOther' is missing the following properties from type 'SomeDerived': x, p
|
||||
|
||||
someOther = /** @type {SomeOther} */(someDerived); // Error
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
!!! error TS2352: Conversion of type 'SomeDerived' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
!!! error TS2352: Property 'q' is missing in type 'SomeDerived' but required in type 'SomeOther'.
|
||||
!!! related TS2728 tests/cases/conformance/jsdoc/b.js:28:9: 'q' is declared here.
|
||||
someOther = /** @type {SomeOther} */(someBase); // Error
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
~~~~~~~~~
|
||||
!!! error TS2352: Conversion of type 'SomeBase' to type 'SomeOther' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
|
||||
!!! error TS2352: Property 'q' is missing in type 'SomeBase' but required in type 'SomeOther'.
|
||||
!!! related TS2728 tests/cases/conformance/jsdoc/b.js:28:9: 'q' is declared here.
|
||||
|
||||
Reference in New Issue
Block a user