mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 21:07:52 -05:00
Fixed a crash when trying to find references on NoSubstitutionTemplateLiteral with LiteralType parent (#59889)
This commit is contained in:
committed by
GitHub
parent
9f150e00df
commit
88809467e8
@@ -4227,7 +4227,9 @@ export function tryGetImportFromModuleSpecifier(node: StringLiteralLike): AnyVal
|
||||
case SyntaxKind.CallExpression:
|
||||
return isImportCall(node.parent) || isRequireCall(node.parent, /*requireStringLiteralLikeArgument*/ false) ? node.parent as RequireOrImportCall : undefined;
|
||||
case SyntaxKind.LiteralType:
|
||||
Debug.assert(isStringLiteral(node));
|
||||
if (!isStringLiteral(node)) {
|
||||
break;
|
||||
}
|
||||
return tryCast(node.parent.parent, isImportTypeNode) as ValidImportTypeNode | undefined;
|
||||
default:
|
||||
return undefined;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// === findAllReferences ===
|
||||
// === /tests/cases/fourslash/findAllRefsNoSubstitutionTemplateLiteralNoCrash1.ts ===
|
||||
// type Test = `[|{| isInString: true |}T|]/*FIND ALL REFS*/`;
|
||||
|
||||
// === Definitions ===
|
||||
// === /tests/cases/fourslash/findAllRefsNoSubstitutionTemplateLiteralNoCrash1.ts ===
|
||||
// type Test = `[|T|]/*FIND ALL REFS*/`;
|
||||
|
||||
// === Details ===
|
||||
[
|
||||
{
|
||||
"containerKind": "",
|
||||
"containerName": "",
|
||||
"kind": "var",
|
||||
"name": "T",
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "`T`",
|
||||
"kind": "stringLiteral"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// type Test = `T/*1*/`;
|
||||
|
||||
verify.baselineFindAllReferences('1');
|
||||
Reference in New Issue
Block a user