mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 15:25:54 -06:00
Handle when type alias's type parameter extends type that wont get emitted in .d.ts
Fixes #12326
This commit is contained in:
parent
cbde25f229
commit
aa556502f3
@ -1037,6 +1037,10 @@ namespace ts {
|
||||
diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_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;
|
||||
|
||||
default:
|
||||
Debug.fail("This is unknown parent for type parameter: " + node.parent.kind);
|
||||
}
|
||||
|
||||
@ -2276,6 +2276,10 @@
|
||||
"category": "Error",
|
||||
"code": 4082
|
||||
},
|
||||
"Type parameter '{0}' of exported type alias has or is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4083
|
||||
},
|
||||
"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.": {
|
||||
"category": "Message",
|
||||
"code": 4090
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
tests/cases/compiler/declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts(2,18): error TS2304: Cannot find name 'Unknown'.
|
||||
tests/cases/compiler/declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts(2,18): error TS4083: Type parameter 'T' of exported type alias has or is using private name 'Unknown'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts (2 errors) ====
|
||||
|
||||
type A<T extends Unknown> = {}
|
||||
~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'Unknown'.
|
||||
~~~~~~~
|
||||
!!! error TS4083: Type parameter 'T' of exported type alias has or is using private name 'Unknown'.
|
||||
@ -0,0 +1,5 @@
|
||||
//// [declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.ts]
|
||||
|
||||
type A<T extends Unknown> = {}
|
||||
|
||||
//// [declarationEmitTypeAliasTypeParameterExtendingUnknownSymbol.js]
|
||||
@ -0,0 +1,3 @@
|
||||
// @declaration: true
|
||||
|
||||
type A<T extends Unknown> = {}
|
||||
Loading…
x
Reference in New Issue
Block a user