From 25086faf7b27e369b1f0d7cc0920f63528914204 Mon Sep 17 00:00:00 2001 From: Peach Date: Tue, 19 Sep 2023 16:29:25 +0800 Subject: [PATCH] fix: type roots behavior is inconsistent with tsc (#716) --- src/builder/bundless/dts/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/builder/bundless/dts/index.ts b/src/builder/bundless/dts/index.ts index a2a3e44b..181c1986 100644 --- a/src/builder/bundless/dts/index.ts +++ b/src/builder/bundless/dts/index.ts @@ -19,6 +19,7 @@ export function getTsconfigPath(cwd: string) { /** * get parsed tsconfig.json for specific path + * ref: https://github.com/privatenumber/get-tsconfig#how-can-i-use-typescript-to-parse-tsconfigjson */ export function getTsconfig(cwd: string) { // use require() rather than import(), to avoid jest runner to fail @@ -32,6 +33,10 @@ export function getTsconfig(cwd: string) { tsconfigFile.config, ts.sys, path.dirname(tsconfigPath), + undefined, + // specify config file path like tsc, to ensure type roots behavior same as tsc + // ref: https://github.com/microsoft/TypeScript/blob/0464e91c8b67579a4ed840e5783575a493c958e0/src/compiler/program.ts#L2325 + tsconfigPath, ); } }