Skip to content

Commit

Permalink
Fix error type regression in new TS (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
zababurinsv authored Oct 24, 2021
1 parent 4c2d29f commit f5300cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ try {
}
}
} catch (err) {
term.writeln(err.message);
term.writeln((err as Error).message);
}
}
})();
4 changes: 2 additions & 2 deletions src/fileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class OpenDirectory {
try {
return await parent.getFileHandle(name, { create });
} catch (err) {
if (err.name === 'TypeMismatchError') {
if ((err as Error).name === 'TypeMismatchError') {
if (!(mode & FileOrDir.Dir)) {
console.warn(err);
throw new SystemError(E.ISDIR);
Expand All @@ -181,7 +181,7 @@ class OpenDirectory {
try {
return await parent.getDirectoryHandle(name, { create });
} catch (err) {
if (err.name === 'TypeMismatchError') {
if ((err as Error).name === 'TypeMismatchError') {
console.warn(err);
throw new SystemError(E.NOTDIR);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ runBtn.onclick = async () => {
if (err instanceof WebAssembly.RuntimeError) {
message = `Wasm failed on \`unreachable\`:\n${actualStderr}`;
} else {
message = err.message;
message = (err as Error).message;
}
resultCell.textContent = `NOT OK: ${message}`;
}
Expand Down

0 comments on commit f5300cd

Please sign in to comment.