mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Make isEntityNameVisible duplicate the node builder logic to always consider type parameters as visible if they are the resolution result (#38921)
This commit is contained in:
parent
a72ed0a2f5
commit
f41398e100
@ -4064,6 +4064,9 @@ namespace ts {
|
||||
|
||||
const firstIdentifier = getFirstIdentifier(entityName);
|
||||
const symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
|
||||
if (symbol && symbol.flags & SymbolFlags.TypeParameter && meaning & SymbolFlags.Type) {
|
||||
return { accessibility: SymbolAccessibility.Accessible };
|
||||
}
|
||||
|
||||
// Verify if the symbol is accessible
|
||||
return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
//// [declarationEmitTypeParamMergedWithPrivate.ts]
|
||||
export class Test<T> {
|
||||
private get T(): T {
|
||||
throw "";
|
||||
}
|
||||
|
||||
public test(): T {
|
||||
return null as any;
|
||||
}
|
||||
}
|
||||
|
||||
//// [declarationEmitTypeParamMergedWithPrivate.js]
|
||||
export class Test {
|
||||
get T() {
|
||||
throw "";
|
||||
}
|
||||
test() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [declarationEmitTypeParamMergedWithPrivate.d.ts]
|
||||
export declare class Test<T> {
|
||||
private get T();
|
||||
test(): T;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/declarationEmitTypeParamMergedWithPrivate.ts ===
|
||||
export class Test<T> {
|
||||
>Test : Symbol(Test, Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 18), Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 22))
|
||||
|
||||
private get T(): T {
|
||||
>T : Symbol(T, Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 18), Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 22))
|
||||
>T : Symbol(T, Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 18), Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 22))
|
||||
|
||||
throw "";
|
||||
}
|
||||
|
||||
public test(): T {
|
||||
>test : Symbol(Test.test, Decl(declarationEmitTypeParamMergedWithPrivate.ts, 3, 5))
|
||||
>T : Symbol(T, Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 18), Decl(declarationEmitTypeParamMergedWithPrivate.ts, 0, 22))
|
||||
|
||||
return null as any;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/declarationEmitTypeParamMergedWithPrivate.ts ===
|
||||
export class Test<T> {
|
||||
>Test : Test<T>
|
||||
|
||||
private get T(): T {
|
||||
>T : T
|
||||
|
||||
throw "";
|
||||
>"" : ""
|
||||
}
|
||||
|
||||
public test(): T {
|
||||
>test : () => T
|
||||
|
||||
return null as any;
|
||||
>null as any : any
|
||||
>null : null
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
// @declaration: true
|
||||
// @target: es6
|
||||
export class Test<T> {
|
||||
private get T(): T {
|
||||
throw "";
|
||||
}
|
||||
|
||||
public test(): T {
|
||||
return null as any;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user