mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-12 21:37:41 -06:00
Fix bug: VariableDeclaration initializer may be undefined (#24256)
This commit is contained in:
parent
153c1806d3
commit
c09cc70ebe
@ -76,7 +76,7 @@ namespace ts.refactor {
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
return !hasModifier(node, ModifierFlags.Export);
|
||||
case SyntaxKind.VariableStatement:
|
||||
return (node as VariableStatement).declarationList.declarations.every(d => isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true));
|
||||
return (node as VariableStatement).declarationList.declarations.every(d => d.initializer && isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true));
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
// @Filename: /a.ts
|
||||
////[|import { a, b } from "m";
|
||||
////let l;
|
||||
////a;|]
|
||||
////b;
|
||||
|
||||
@ -10,8 +11,9 @@ verify.moveToNewFile({
|
||||
"/a.ts":
|
||||
`import { b } from "m";
|
||||
b;`,
|
||||
"/newFile.ts":
|
||||
"/l.ts":
|
||||
`import { a } from "m";
|
||||
let l;
|
||||
a;`,
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user