From c29fbad7b7a8778c1f3af25e09768dcdfee44dfb Mon Sep 17 00:00:00 2001 From: Stephen Hurley Date: Sun, 28 Jul 2024 12:06:30 -0700 Subject: [PATCH] fix: Fixed undefined error in resolveTSAliases when compilerOptions.paths is absent. --- src/utils/get-import-declaration-path.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/get-import-declaration-path.ts b/src/utils/get-import-declaration-path.ts index 019ee28..903b126 100644 --- a/src/utils/get-import-declaration-path.ts +++ b/src/utils/get-import-declaration-path.ts @@ -19,8 +19,8 @@ function cleanTsConfig(content: string) { function resolveTSAlias(tsconfigpath: string, to: string, cwd: string) { const tsconfig = readFileSync(tsconfigpath, "utf-8"); - const aliases = JSON.parse(cleanTsConfig(tsconfig)).compilerOptions - .paths as Record; + const aliases = (JSON.parse(cleanTsConfig(tsconfig)).compilerOptions + .paths ?? {}) as Record; let res = Object.entries(aliases) // sorting by longest - most qualified - alias