diff --git a/package.json b/package.json index 1880710..23d5dff 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "lodash": "4.x", "node-getopt": "0.2.x", "source-map": "0.5.x", - "typescript": "3.9.x" + "typescript": "4.9" }, "scripts": { "test": "mocha --ui tdd" diff --git a/src/typechecker/DiagnosticParser.js b/src/typechecker/DiagnosticParser.js index c7699b2..39d0a60 100644 --- a/src/typechecker/DiagnosticParser.js +++ b/src/typechecker/DiagnosticParser.js @@ -222,20 +222,22 @@ getWarnings(diagnostics, fileCallback) fileName = fileCallback(fileName); if (!fileName) return null; - let result = { - code: code, - column: lineColumn.column, - name: NSWarning.Typechecker, - file: fileName, - line: lineNumber, - reason: reason - }; - // Only return if this error message is unique (defs can spam duplicate messages) - let key = result.file + ":" + result.line + ":" + result.reason; + let key = fileName + ":" + lineNumber + ":" + reason; + if (!duplicateMap[key]) { duplicateMap[key] = true; - return result; + + let error = new Error(reason); + + error.name = NSWarning.Typechecker; + error.file = fileName; + error.line = lineNumber; + error.column = lineColumn.column; + error.reason = reason; + error.code = code; + + return error; } return null; diff --git a/src/typechecker/Typechecker.js b/src/typechecker/Typechecker.js index cebfc85..0f3d795 100644 --- a/src/typechecker/Typechecker.js +++ b/src/typechecker/Typechecker.js @@ -165,6 +165,8 @@ async check(model, defs, files) return sourceFile; }, + fileExists: () => { return false; }, + readFile: () => { }, writeFile: () => { }, getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), useCaseSensitiveFileNames: () => false,