diff --git a/lib/typescript.js b/lib/typescript.js index 4b7a6252d383f..714953f466fc4 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -141458,8 +141458,9 @@ interface Symbol { readonly [Symbol.toStringTag]: string; }`; var barebonesLibName = "lib.d.ts"; -var barebonesLibSourceFile = createSourceFile(barebonesLibName, barebonesLibContent, { languageVersion: 99 /* Latest */ }); +var barebonesLibSourceFile; function transpileWorker(input, transpileOptions, declaration) { + barebonesLibSourceFile ?? (barebonesLibSourceFile = createSourceFile(barebonesLibName, barebonesLibContent, { languageVersion: 99 /* Latest */ })); const diagnostics = []; const options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {}; const defaultOptions = getDefaultCompilerOptions2(); @@ -143929,7 +143930,7 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR const unusedImportsFromOldFile = /* @__PURE__ */ new Set(); for (const statement of toMove) { forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => { - if (!symbol.declarations) { + if (!symbol.declarations || isGlobalType(checker, symbol)) { return; } if (existingTargetLocals.has(skipAlias(symbol, checker))) { @@ -143979,6 +143980,16 @@ function getUsageInfo(oldFile, toMove, checker, existingTargetLocals = /* @__PUR return !!jsxNamespaceSymbol2 && some(jsxNamespaceSymbol2.declarations, isInImport) ? jsxNamespaceSymbol2 : void 0; } } +function isGlobalType(checker, symbol) { + return !!checker.resolveName( + symbol.name, + /*location*/ + void 0, + 788968 /* Type */, + /*excludeGlobals*/ + false + ); +} function makeUniqueFilename(proposedFilename, extension, inDirectory, host) { let newFilename = proposedFilename; for (let i = 1; ; i++) {