Skip to content

Commit 812d17e

Browse files
committed
refactor: use factory functions instead of deprecated functions
1 parent 69b44f9 commit 812d17e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/addAnyTypeCast.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ export default function addAsAnyToObjectLiterals(oldSource: string): string {
55
return function transform(rootNode: T) {
66
function visit(node: ts.Node): ts.Node {
77
if (node.kind === ts.SyntaxKind.ObjectLiteralExpression) {
8-
return ts.createAsExpression(
8+
return ts.factory.createAsExpression(
99
node as ts.Expression,
10-
ts.createTypeReferenceNode("any", [])
10+
ts.factory.createTypeReferenceNode("any", [])
1111
);
1212
}
1313
return ts.visitEachChild(node, visit, context);
@@ -27,7 +27,7 @@ export default function addAsAnyToObjectLiterals(oldSource: string): string {
2727
const result = ts.transform(source, [transformer]);
2828

2929
const printer: ts.Printer = ts.createPrinter({
30-
newLine: ts.NewLineKind.LineFeed
30+
newLine: ts.NewLineKind.LineFeed,
3131
});
3232
return printer.printFile(result.transformed[0] as ts.SourceFile);
3333
}

0 commit comments

Comments
 (0)