Skip to content

Commit 490d0c8

Browse files
fix: detect TS >= 5.4 across major versions
The previous regex /^[5-9]\.([4-9]|[1-9]\d)/ only matched X.4 and above within each major, so TypeScript 6.0–6.3 fell through to the legacy require()-based loader — which returns moduleResolution as a raw string and reproduces #52 on the very versions this PR targets. Switch to a numeric major/minor comparison.
1 parent 628c8df commit 490d0c8

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@types/download": "^8.0.5",
3838
"@types/minimist": "^1.2.5",
3939
"@types/mkdirp": "^2.0.0",
40-
"@types/node": "^25.6.0",
40+
"@types/node": "^24.12.2",
4141
"@vitest/coverage-istanbul": "^4.1.5",
4242
"simple-git-hooks": "^2.13.1",
4343
"tsx": "^4.21.0",

src/compileTypes/helpers/getTSConfigCompilerOptions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export function getTSConfigCompilerOptions(
1717

1818
logger.log('tsc compiler version:', ts.version);
1919

20-
if (ts.version.match(/^[5-9]\.([4-9]|[1-9]\d)/)) {
20+
const [major, minor] = ts.version.split('.').map(Number);
21+
const isTs54OrNewer = major > 5 || (major === 5 && minor >= 4);
22+
if (isTs54OrNewer) {
2123
const tsconfigJsonFile = ts.readJsonConfigFile(tsconfigPath, ts.sys.readFile);
2224
const parsedConfig = ts.parseJsonSourceFileConfigFileContent(
2325
tsconfigJsonFile,

0 commit comments

Comments
 (0)