Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to ts 5 #1612

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,34 @@
"@types/json-schema": "^7.0.11",
"commander": "^10.0.0",
"glob": "^8.0.3",
"json5": "^2.2.1",
"json5": "^2.2.3",
"normalize-path": "^3.0.0",
"safe-stable-stringify": "^2.4.1",
"typescript": "~4.9.3"
"safe-stable-stringify": "^2.4.2",
"typescript": "~5.0.2"
},
"devDependencies": {
"@auto-it/conventional-commits": "^10.37.6",
"@auto-it/first-time-contributor": "^10.37.6",
"@babel/core": "^7.20.5",
"@auto-it/conventional-commits": "^10.43.0",
"@auto-it/first-time-contributor": "^10.43.0",
"@babel/core": "^7.21.3",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@types/glob": "^8.0.0",
"@types/jest": "^29.2.3",
"@types/node": "^18.11.10",
"@babel/preset-typescript": "^7.21.0",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.3",
"@types/normalize-path": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"ajv": "^8.11.2",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"auto": "^10.37.6",
"auto": "^10.43.0",
"chai": "^4.3.7",
"cross-env": "^7.0.3",
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.3.1",
"jest": "^29.5.0",
"jest-junit": "^15.0.0",
"prettier": "^2.8.0",
"prettier": "^2.8.4",
"ts-node": "^10.9.1",
"vega": "^5.22.1",
"vega-lite": "^5.6.0"
Expand Down
2 changes: 1 addition & 1 deletion src/NodeParser/InterfaceAndClassNodeParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class InterfaceAndClassNodeParser implements SubNodeParser {

// Use the type checker if the member has no explicit type
// Ignore members without an initializer. They have no useful type.
if (memberType === undefined && member.initializer !== undefined) {
if (memberType === undefined && (member as ts.PropertyDeclaration)?.initializer !== undefined) {
const type = this.typeChecker.getTypeAtLocation(member);
memberType = this.typeChecker.typeToTypeNode(type, node, ts.NodeBuilderFlags.NoTruncation);
}
Expand Down
5 changes: 3 additions & 2 deletions src/NodeParser/TypeofNodeParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export class TypeofNodeParser implements SubNodeParser {
ts.isPropertySignature(valueDec) ||
ts.isPropertyDeclaration(valueDec)
) {
let initializer: ts.Expression | undefined;
if (valueDec.type) {
return this.childNodeParser.createType(valueDec.type, context);
} else if (valueDec.initializer) {
return this.childNodeParser.createType(valueDec.initializer, context);
} else if ((initializer = (valueDec as ts.VariableDeclaration | ts.PropertyDeclaration)?.initializer)) {
return this.childNodeParser.createType(initializer, context);
}
} else if (ts.isClassDeclaration(valueDec)) {
return this.childNodeParser.createType(valueDec, context);
Expand Down
6 changes: 3 additions & 3 deletions src/Utils/modifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ts from "typescript";
* @param modifier - The modifier to look for.
* @return True if node has the modifier, false if not.
*/
export function hasModifier(node: ts.Node, modifier: ts.SyntaxKind): boolean {
export function hasModifier(node: ts.HasModifiers, modifier: ts.SyntaxKind): boolean {
const nodeModifiers = node.modifiers;
if (nodeModifiers == null) {
return false;
Expand All @@ -22,7 +22,7 @@ export function hasModifier(node: ts.Node, modifier: ts.SyntaxKind): boolean {
* @param node - The node to check.
* @return True if node is public, false if not.
*/
export function isPublic(node: ts.Node): boolean {
export function isPublic(node: ts.HasModifiers): boolean {
return !(hasModifier(node, ts.SyntaxKind.PrivateKeyword) || hasModifier(node, ts.SyntaxKind.ProtectedKeyword));
}

Expand All @@ -32,6 +32,6 @@ export function isPublic(node: ts.Node): boolean {
* @param node - The node to check.
* @return True if node is static, false if not.
*/
export function isStatic(node: ts.Node): boolean {
export function isStatic(node: ts.HasModifiers): boolean {
return hasModifier(node, ts.SyntaxKind.StaticKeyword);
}