Skip to content

Commit

Permalink
Merge pull request #132 from sellersindustry/fixed-node-type-issues
Browse files Browse the repository at this point in the history
Fixed Node Type Issues
  • Loading branch information
SellersEvan authored May 24, 2024
2 parents dc823da + ab69625 commit 2e552c0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<p align="center">
<a href="https://docs.page/sellersindustry/SherpaJS">
<img src="./docs/assets/logos/favicon.png" height="128px"/>
<img src="https://github.com/sellersindustry/SherpaJS/raw/main/docs/assets/logos/favicon.png" height="128px"/>
<h1 align="center">SherpaJS</h1>
</a>
</p>
Expand Down
6 changes: 2 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@types/checksum": "^0.1.35",
"@types/eslint": "^8.56.2",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.4",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.56.0",
Expand All @@ -47,6 +46,7 @@
"license": "ISC",
"dependencies": {
"@offen/esbuild-plugin-jsonschema": "^1.1.0",
"@types/node": "^20.12.4",
"ajv": "^8.13.0",
"checksum": "^1.0.0",
"chokidar": "^3.6.0",
Expand Down
15 changes: 11 additions & 4 deletions src/compiler/utilities/tooling/type-validation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export async function typeValidation(filepath:string, fileTypeName:string):Promi
} catch (error) {
return [{
level: Level.ERROR,
text: `Failed to parse ${this.fileTypeName}.`,
text: `Failed to parse ${fileTypeName}.`,
content: error.message,
file: { filepath: this.filepath }
file: { filepath: filepath }
}];
}
}
Expand All @@ -44,7 +44,8 @@ function getDiagnostics(filepath:string):readonly ts.Diagnostic[] {
let program = ts.createProgram({
rootNames: [filepath],
options: {
noEmit: true
noEmit: true,
lib: ["es2022"]
},
host: {
...ts.createCompilerHost({}),
Expand All @@ -57,7 +58,13 @@ function getDiagnostics(filepath:string):readonly ts.Diagnostic[] {

function processDiagnostics(filepath:string, fileTypeName:string, diagnostic:readonly ts.Diagnostic[]):Message[] {
return diagnostic.filter(diagnostic => {
return !diagnostic.messageText.toString().includes("--target"); // NOTE: Remove warning about targeting ES2022
if (!diagnostic.start) {
return false;
}
if (diagnostic.messageText.toString().includes("Cannot find namespace 'WebAssembly'")) {
return false;
}
return true;
}).map((diagnostic):Message => {
let position = getLineNumber(filepath, diagnostic.start as number);
let message = diagnostic.messageText.toString();
Expand Down

0 comments on commit 2e552c0

Please sign in to comment.