Skip to content

Commit 444bc5b

Browse files
editor/code: Enable TypeScript's --useUnknownInCatchVariables option
see: https://www.typescriptlang.org/tsconfig#useUnknownInCatchVariables
1 parent a66b7e3 commit 444bc5b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

editors/code/src/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export function ssr(ctx: CtxInit): Cmd {
373373
selections,
374374
});
375375
} catch (e) {
376-
return e.toString();
376+
return String(e);
377377
}
378378
return null;
379379
},
@@ -1156,7 +1156,7 @@ export function viewMemoryLayout(ctx: CtxInit): Cmd {
11561156
<meta http-equiv="X-UA-Compatible" content="IE=edge">
11571157
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11581158
<title>Document</title>
1159-
<style>
1159+
<style>
11601160
* {
11611161
box-sizing: border-box;
11621162
}

editors/code/tests/unit/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as assert from "node:assert/strict";
12
import { readdir } from "fs/promises";
23
import * as path from "path";
34

@@ -30,6 +31,7 @@ class Suite {
3031
await test.promise;
3132
ok(` ✔ ${test.name}`);
3233
} catch (e) {
34+
assert.ok(e instanceof Error);
3335
error(` ✖︎ ${test.name}\n ${e.stack}`);
3436
failed += 1;
3537
}
@@ -50,6 +52,7 @@ export class Context {
5052
await ctx.run();
5153
ok(`✔ ${name}`);
5254
} catch (e) {
55+
assert.ok(e instanceof Error);
5356
error(`✖︎ ${name}\n ${e.stack}`);
5457
throw e;
5558
}

editors/code/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"newLine": "LF",
1313
// These disables some enhancement type checking options
1414
// to update typescript version without any code change.
15-
"useUnknownInCatchVariables": false,
1615
"exactOptionalPropertyTypes": false
1716
},
1817
"exclude": ["node_modules", ".vscode-test"],

0 commit comments

Comments
 (0)