Skip to content

Commit

Permalink
Allow to use with TypeScript > 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
timocov committed Mar 30, 2023
1 parent 315b73c commit a37880f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"homepage": "https://github.com/timocov/ts-transformer-properties-rename",
"peerDependencies": {
"typescript": ">=4.3.0"
"typescript": ">=4.3.0 || >=5.0.0-beta"
},
"devDependencies": {
"@types/chai": "~4.3.3",
Expand Down
6 changes: 6 additions & 0 deletions src/typescript-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ export function hasPrivateKeyword(node: ClassMember | ts.ParameterDeclaration):
return hasModifier(node, ts.SyntaxKind.PrivateKeyword);
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
function getModifiers(node: ts.Node): readonly NonNullable<ts.Node['modifiers']>[number][] {
if (isBreakingTypeScriptApi(ts)) {
if (!ts.canHaveModifiers(node)) {
Expand All @@ -137,6 +139,8 @@ function getModifiers(node: ts.Node): readonly NonNullable<ts.Node['modifiers']>
return ts.getModifiers(node) || [];
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line deprecation/deprecation
return node.modifiers || [];
}
Expand All @@ -154,6 +158,8 @@ function getDecorators(node: ts.Node): readonly unknown[] {
return ts.getDecorators(node) || [];
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line deprecation/deprecation
return node.decorators || [];
}
Expand Down

0 comments on commit a37880f

Please sign in to comment.