Skip to content

Commit

Permalink
refactor: Update for TS 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nonara authored and danielpza committed Sep 3, 2024
1 parent 98faee6 commit b1366ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ export default function transformer(

/* Create Visitor Context */
const { configFile, paths } = compilerOptions;
const { tryParsePatterns } = tsInstance;

const [tsVersionMajor, tsVersionMinor] = tsInstance.versionMajorMinor.split(".").map((v) => +v);
const tryParsePatterns: typeof ts.tryParsePatterns | undefined = tsInstance.tryParsePatterns;

if (!tsVersionMajor || !tsVersionMinor) throw new Error("Expected version to be parsed");

Expand Down
3 changes: 1 addition & 2 deletions src/utils/ts-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type { REGISTER_INSTANCE } from "ts-node";
/** Determine output file path for source file */
export function getOutputDirForSourceFile(context: VisitorContext, sourceFile: SourceFile): string {
const {
tsInstance,
emitHost,
outputFileNamesCache,
compilerOptions,
Expand Down Expand Up @@ -49,7 +48,7 @@ export function isModulePathsMatch(context: VisitorContext, moduleName: string):
pathsPatterns,
tsInstance: { matchPatternOrExact },
} = context;
return !!(pathsPatterns && matchPatternOrExact(pathsPatterns as readonly string[], moduleName));
return !!(pathsPatterns && matchPatternOrExact(pathsPatterns, moduleName));
}

/** Create barebones EmitHost (for no-Program transform) */
Expand Down

0 comments on commit b1366ba

Please sign in to comment.