Skip to content

Commit

Permalink
fix: support latest typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed May 16, 2023
1 parent 4fa23f8 commit 076e33d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/commands/ajv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ export default function (argv: ParsedArgs): AjvCore {
registerer = require("ts-node").register()
} catch (err) {
/* istanbul ignore next */
if (err.code === "MODULE_NOT_FOUND") {
if ((err as {code?: string; message: string}).code === "MODULE_NOT_FOUND") {
throw new Error(
`'ts-node' is required for the TypeScript configuration files. Make sure it is installed\nError: ${err.message}`
`'ts-node' is required for the TypeScript configuration files. Make sure it is installed\nError: ${
(err as Error).message
}`
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/commands/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function openFile(filename: string, suffix: string): any {
json = require(file)
}
} catch (err) {
const msg: string = err.message
const msg: string = (err as Error).message
console.error(`error: ${msg.replace(" module", " " + suffix)}`)
process.exit(2)
}
Expand Down Expand Up @@ -82,7 +82,7 @@ export function compile(ajv: Ajv, schemaFile: string): AnyValidateFunction {
return ajv.compile(schema)
} catch (err) {
console.error(`schema ${schemaFile} is invalid`)
console.error(`error: ${err.message}`)
console.error(`error: ${(err as Error).message}`)
process.exit(1)
}
}

0 comments on commit 076e33d

Please sign in to comment.