mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 11:54:44 -06:00
Fixed crash when reporting infer extends on invalid name with declaration (#52032)
This commit is contained in:
parent
94afa32925
commit
67cdaf9215
@ -3864,6 +3864,10 @@
|
||||
"category": "Error",
|
||||
"code": 4084
|
||||
},
|
||||
"Extends clause for inferred type '{0}' has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4085
|
||||
},
|
||||
"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.": {
|
||||
"category": "Error",
|
||||
"code": 4090
|
||||
|
||||
@ -500,6 +500,10 @@ export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationD
|
||||
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.InferType:
|
||||
diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/types/conditional/inferTypesInvalidExtendsDeclaration.ts(1,42): error TS2304: Cannot find name 'B'.
|
||||
tests/cases/conformance/types/conditional/inferTypesInvalidExtendsDeclaration.ts(1,42): error TS4085: Extends clause for inferred type 'A' has or is using private name 'B'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/conditional/inferTypesInvalidExtendsDeclaration.ts (2 errors) ====
|
||||
type Test<T> = T extends infer A extends B ? number : string;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'B'.
|
||||
~
|
||||
!!! error TS4085: Extends clause for inferred type 'A' has or is using private name 'B'.
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
//// [inferTypesInvalidExtendsDeclaration.ts]
|
||||
type Test<T> = T extends infer A extends B ? number : string;
|
||||
|
||||
|
||||
//// [inferTypesInvalidExtendsDeclaration.js]
|
||||
@ -0,0 +1,8 @@
|
||||
=== tests/cases/conformance/types/conditional/inferTypesInvalidExtendsDeclaration.ts ===
|
||||
type Test<T> = T extends infer A extends B ? number : string;
|
||||
>Test : Symbol(Test, Decl(inferTypesInvalidExtendsDeclaration.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(inferTypesInvalidExtendsDeclaration.ts, 0, 10))
|
||||
>T : Symbol(T, Decl(inferTypesInvalidExtendsDeclaration.ts, 0, 10))
|
||||
>A : Symbol(A, Decl(inferTypesInvalidExtendsDeclaration.ts, 0, 30))
|
||||
>B : Symbol(B)
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
=== tests/cases/conformance/types/conditional/inferTypesInvalidExtendsDeclaration.ts ===
|
||||
type Test<T> = T extends infer A extends B ? number : string;
|
||||
>Test : Test<T>
|
||||
|
||||
@ -1220,6 +1220,7 @@ Info 32 [00:01:13.000] response:
|
||||
"4082",
|
||||
"4083",
|
||||
"4084",
|
||||
"4085",
|
||||
"4090",
|
||||
"4091",
|
||||
"4092",
|
||||
@ -2553,6 +2554,7 @@ Info 38 [00:01:19.000] response:
|
||||
"4082",
|
||||
"4083",
|
||||
"4084",
|
||||
"4085",
|
||||
"4090",
|
||||
"4091",
|
||||
"4092",
|
||||
@ -3798,6 +3800,7 @@ Info 40 [00:01:21.000] response:
|
||||
"4082",
|
||||
"4083",
|
||||
"4084",
|
||||
"4085",
|
||||
"4090",
|
||||
"4091",
|
||||
"4092",
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
// @declaration: true
|
||||
|
||||
type Test<T> = T extends infer A extends B ? number : string;
|
||||
Loading…
x
Reference in New Issue
Block a user