Pulled out of #56251 (comment)
Running tsc -p tsconfig.build.json (via a script) in https://github.com/vuejs/core with 5.3 causes:
> @3.3.7 build-dts /home/jabaile/work/vuejs-core
> tsc -p tsconfig.build.json && rollup -c rollup.dts.config.js
packages/compiler-sfc/src/parse.ts:96:14 - error TS2742: The inferred type of 'parseCache' cannot be named without a reference to '../node_modules/lru-cache/dist/mjs'. This is likely not portable. A type annotation is necessary.
96 export const parseCache = createCache<SFCParseResult>()
~~~~~~~~~~
Found 1 error in packages/compiler-sfc/src/parse.ts:96
ELIFECYCLE Command failed with exit code 1.
This is odd, because createCache is defined as:
import { LRUCache } from 'lru-cache'
export function createCache<T extends {}>(
max = 500
): Map<string, T> | LRUCache<string, T> {
if (__GLOBAL__ || __ESM_BROWSER__) {
return new Map<string, T>()
}
return new LRUCache({ max })
}
A bisect points to #55725, and we unfortunately didn't run the extended suite there. cc @andrewbranch
I can fix this with an explicit annotation, but this feels weird.
The funkiness here seems to be that this is a monorepo build of all files in various /packages/** dirs, but the output goes into /temp, meaning no d.ts file's imports resolve properly. Before, the export would get an annotation of import("lru-cache"), but now it tries to emit a real import, or something along those lines.
Pulled out of #56251 (comment)
Running
tsc -p tsconfig.build.json(via a script) in https://github.com/vuejs/core with 5.3 causes:This is odd, because
createCacheis defined as:A bisect points to #55725, and we unfortunately didn't run the extended suite there. cc @andrewbranch
I can fix this with an explicit annotation, but this feels weird.
The funkiness here seems to be that this is a monorepo build of all files in various
/packages/**dirs, but the output goes into/temp, meaning nod.tsfile's imports resolve properly. Before, the export would get an annotation ofimport("lru-cache"), but now it tries to emit a real import, or something along those lines.