Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) || {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
11 changes: 11 additions & 0 deletions tests/cases/compiler/declarationEmitTypeParamMergedWithPrivate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @declaration: true
// @target: es6
export class Test<T> {
private get T(): T {
throw "";
}

public test(): T {
return null as any;
}
}