Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent type parameter printing from recuring on the same symbol #31453

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/compiler/checker.ts
Expand Up @@ -4302,6 +4302,11 @@ namespace ts {
function lookupTypeParameterNodes(chain: Symbol[], index: number, context: NodeBuilderContext) {
Debug.assert(chain && 0 <= index && index < chain.length);
const symbol = chain[index];
const symbolId = "" + getSymbolId(symbol);
if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) {
return undefined;
}
(context.typeParameterSymbolList || (context.typeParameterSymbolList = createMap())).set(symbolId, true);
let typeParameterNodes: ReadonlyArray<TypeNode> | ReadonlyArray<TypeParameterDeclaration> | undefined;
if (context.flags & NodeBuilderFlags.WriteTypeParametersInQualifiedName && index < (chain.length - 1)) {
const parentSymbol = symbol;
Expand Down Expand Up @@ -4628,6 +4633,7 @@ namespace ts {
inferTypeParameters: TypeParameter[] | undefined;
approximateLength: number;
truncating?: boolean;
typeParameterSymbolList?: Map<true>;
}

function isDefaultBindingContext(location: Node) {
Expand Down
@@ -0,0 +1,21 @@
/// <reference path="fourslash.ts" />


//// declare namespace AMap {
//// namespace MassMarks {
//// interface Data {
//// style?: number;
//// }
//// }
//// class MassMarks<D extends MassMarks.Data = MassMarks.Data> {
//// constructor(data: D[] | string);
//// clear(): void;
//// }
//// }
////
//// interface MassMarksCustomData extends AMap.MassMarks./*1*/Data {
//// name: string;
//// id: string;
//// }

verify.quickInfoAt("1", "interface AMap.MassMarks<D extends AMap.MassMarks.Data = AMap.MassMarks.Data>.Data");