Pages

Friday, September 11, 2026

Touche, Copilot, touche

As I'm wrapping up today, GPT-5 mini via Copilot gave me code that included:

? window.platform.isWindows
: globalThis.isWindows === true;

Me: if it's never truthy when we want to equate to false then just use truthiness. make sense?

Copilot: Yes — that makes sense if you control all assignments. Prefer reading once and coercing to a boolean, then use plain truthiness everywhere.

Edits to this (following what it just said):

const isWindows = !!(
    window.platform?.isWindows 
    ?? globalThis.isWindows
);

Me: no I also hate !!. If you want hard typed booleans go help someone with typescript. you don't code javascript like that.

Copilot: Do you want a full conversion to TypeScript (rename files, add types, adjust build) or just add TypeScript typings/declarations for window.platform (no build changes)?

Touché.