Skip to content

Commit c70f195

Browse files
committed
refactor: Update for TS 4.4
1 parent ebefe66 commit c70f195

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@
5858
"prettier": "^2.3.2",
5959
"rimraf": "^3.0.2",
6060
"standard-version": "^9.3.1",
61-
"ts-expose-internals": "^4.3.2",
61+
"ts-expose-internals": "^4.4.3",
6262
"ts-jest": "^27.0.4",
6363
"ts-node": "^10.1.0",
6464
"ts-patch": "^1.4.2",
65-
"typescript": "^4.3.5"
65+
"typescript": "^4.4.3"
6666
},
6767
"peerDependencies": {
6868
"typescript": ">=3.6.5"

src/transformer.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ export default function transformer(
8787
}
8888

8989
const { configFile, paths } = compilerOptions;
90-
// TODO - Remove typecast when tryParsePatterns is recognized (probably after ts v4.4)
91-
const { tryParsePatterns } = tsInstance as any;
90+
const tryParsePatterns: typeof ts.tryParsePatterns | undefined = tsInstance.tryParsePatterns;
9291

9392
const tsTransformPathsContext: TsTransformPathsContext = {
9493
compilerOptions,
@@ -108,8 +107,7 @@ export default function transformer(
108107
pathsPatterns:
109108
paths &&
110109
(tryParsePatterns
111-
? // TODO - Remove typecast when pathPatterns is recognized (probably after ts v4.4)
112-
(configFile?.configFileSpecs as any)?.pathPatterns || tryParsePatterns(paths)
110+
? configFile?.configFileSpecs?.pathPatterns || tryParsePatterns(paths)
113111
: tsInstance.getOwnKeys(paths)),
114112
};
115113

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export interface TsTransformPathsContext {
4848
readonly rootDirs?: string[];
4949
readonly excludeMatchers: IMinimatch[] | undefined;
5050
readonly outputFileNamesCache: Map<SourceFile, string>;
51-
readonly pathsPatterns: (string | Pattern)[] | undefined;
51+
readonly pathsPatterns: readonly (string | Pattern)[] | undefined;
5252
readonly emitHost: EmitHost;
5353
readonly isTsNode: boolean;
5454
}

src/utils/ts-helpers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import type { REGISTER_INSTANCE } from "ts-node";
1212
*/
1313
export function getOutputDirForSourceFile(context: VisitorContext, sourceFile: SourceFile): string {
1414
const {
15-
tsInstance,
1615
emitHost,
1716
outputFileNamesCache,
1817
compilerOptions,
@@ -49,7 +48,7 @@ export function isModulePathsMatch(context: VisitorContext, moduleName: string):
4948
pathsPatterns,
5049
tsInstance: { matchPatternOrExact },
5150
} = context;
52-
return !!(pathsPatterns && matchPatternOrExact(pathsPatterns as readonly string[], moduleName));
51+
return !!(pathsPatterns && matchPatternOrExact(pathsPatterns, moduleName));
5352
}
5453

5554
/**

yarn.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3637,10 +3637,10 @@ trim-off-newlines@^1.0.0:
36373637
resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3"
36383638
integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM=
36393639

3640-
ts-expose-internals@^4.3.2:
3641-
version "4.3.2"
3642-
resolved "https://registry.yarnpkg.com/ts-expose-internals/-/ts-expose-internals-4.3.2.tgz#99ea3fd7b2b0750e994143c20fe269a5d434dee1"
3643-
integrity sha512-QqBZDp8fOVFW+/+taGQXx6K/gmU+/Zs9yLxcZcrMObHhmvqBzuImjIU7ZTY/HfcZStO2eXWtJrIlFNjepCV1ew==
3640+
ts-expose-internals@^4.4.3:
3641+
version "4.4.3"
3642+
resolved "https://registry.yarnpkg.com/ts-expose-internals/-/ts-expose-internals-4.4.3.tgz#02cd43988403b35d266ac69bf5bee02a885093f4"
3643+
integrity sha512-hvdD6g3aOdh6vnTMBpKfy+mfG4uTxN7aq5PYC1/s0MCqEKY3+1QD0o1yEgafIGzp9Bi4k7ciaB/lPWV8s55xTQ==
36443644

36453645
ts-jest@^27.0.4:
36463646
version "27.0.4"
@@ -3734,10 +3734,10 @@ typedarray@^0.0.6:
37343734
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
37353735
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
37363736

3737-
typescript@^4.3.5:
3738-
version "4.3.5"
3739-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
3740-
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
3737+
typescript@^4.4.3:
3738+
version "4.4.3"
3739+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
3740+
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==
37413741

37423742
uglify-js@^3.1.4:
37433743
version "3.13.5"

0 commit comments

Comments
 (0)