Skip to content

Commit 8371d42

Browse files
authored
Improve types in page check (#1730)
This really doesn't matter much but it bugged me that I had to use `!` on line 93. I think this is better.
1 parent fac4496 commit 8371d42

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

scripts/commands/checkPagesRender.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ zxMain(async () => {
9090
const response = await canRender(fp);
9191

9292
if (response.ok) {
93-
renderTimes.push(response.timeTaken!);
93+
renderTimes.push(response.timeTaken);
9494
} else {
9595
console.error(`❌ Failed to render: ${fp}`);
9696
failures.push(fp);
@@ -119,12 +119,10 @@ zxMain(async () => {
119119
}
120120
});
121121

122-
type RenderResult = {
123-
ok: boolean;
124-
timeTaken?: number;
125-
};
122+
type RenderSuccess = { ok: true; timeTaken: number };
123+
type RenderFailure = { ok: false };
126124

127-
async function canRender(fp: string): Promise<RenderResult> {
125+
async function canRender(fp: string): Promise<RenderSuccess | RenderFailure> {
128126
const url = pathToUrl(fp);
129127
let timeTaken;
130128
try {

0 commit comments

Comments
 (0)