(type, context)
| 53743 | return false; |
| 53744 | } |
| 53745 | function typeParameterToName(type, context) { |
| 53746 | var _a, _b; |
| 53747 | if (context.flags & 4 /* NodeBuilderFlags.GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) { |
| 53748 | var cached = context.typeParameterNames.get(getTypeId(type)); |
| 53749 | if (cached) { |
| 53750 | return cached; |
| 53751 | } |
| 53752 | } |
| 53753 | var result = symbolToName(type.symbol, context, 788968 /* SymbolFlags.Type */, /*expectsIdentifier*/ true); |
| 53754 | if (!(result.kind & 79 /* SyntaxKind.Identifier */)) { |
| 53755 | return ts.factory.createIdentifier("(Missing type parameter)"); |
| 53756 | } |
| 53757 | if (context.flags & 4 /* NodeBuilderFlags.GenerateNamesForShadowedTypeParams */) { |
| 53758 | var rawtext = result.escapedText; |
| 53759 | var i = ((_a = context.typeParameterNamesByTextNextNameCount) === null || _a === void 0 ? void 0 : _a.get(rawtext)) || 0; |
| 53760 | var text = rawtext; |
| 53761 | while (((_b = context.typeParameterNamesByText) === null || _b === void 0 ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) { |
| 53762 | i++; |
| 53763 | text = "".concat(rawtext, "_").concat(i); |
| 53764 | } |
| 53765 | if (text !== rawtext) { |
| 53766 | result = ts.factory.createIdentifier(text, result.typeArguments); |
| 53767 | } |
| 53768 | // avoiding iterations of the above loop turns out to be worth it when `i` starts to get large, so we cache the max |
| 53769 | // `i` we've used thus far, to save work later |
| 53770 | (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = new ts.Map())).set(rawtext, i); |
| 53771 | (context.typeParameterNames || (context.typeParameterNames = new ts.Map())).set(getTypeId(type), result); |
| 53772 | (context.typeParameterNamesByText || (context.typeParameterNamesByText = new ts.Set())).add(rawtext); |
| 53773 | } |
| 53774 | return result; |
| 53775 | } |
| 53776 | function symbolToName(symbol, context, meaning, expectsIdentifier) { |
| 53777 | var chain = lookupSymbolChain(symbol, context, meaning); |
| 53778 | if (expectsIdentifier && chain.length !== 1 |
no test coverage detected
searching dependent graphs…