TypeScript Stories
60 subscribers
40 links
Download Telegram
5️⃣
🧐 A bit more complex guarded type.

▶️ Playground
6️⃣
Inaccurate "1/1" | "2/2" type inference.

▶️ Playground
7️⃣
No errors when mutating tuples by number index.

▶️ Playground
8️⃣
Interface doesn't fit Record<string, unknown>.

▶️ Playground
9️⃣
🤯 Type any passes extends operator along both branches.

▶️ Playground
🔟
Brand as key of Record might be type unsafe.
▶️ Playground

🤨 But Flavour as key of Record is just OK.
▶️ Playground
1️⃣1️⃣
😢 Would be more useful to warn about useless operations.

▶️ Playground
1️⃣2️⃣
No error on Record<string, number> addition assignments with
"compilerOptions": {
"noUncheckedIndexedAccess": true
}

▶️ Playground
1️⃣3️⃣
Implicit coercion in TypeScript.

▶️ Playground

UPD: not relevant anymore for TS v5.0.2

▶️ Playground
1️⃣4️⃣
Strange default parameter type behavior.

▶️ Playground
1️⃣5️⃣
🤨 Mysterious undefined appearance.

▶️ Playground
1️⃣6️⃣
Dynamic destructuring of function parameter is not allowed.

▶️ Playground
1️⃣7️⃣
😢 Wrong optional chaining type narrowing in if statement.

▶️ Playground
1️⃣8️⃣
Using variable before assignment is not forbidden.

▶️ Playground
1️⃣9️⃣
Wrong type inference of union with object.

▶️ Playground
2️⃣0️⃣
😢 No type narrowing with unions via typeof operator.

▶️ Playground
2️⃣1️⃣
🤔 Types 'asd' | string and 123 & number.

▶️ Playground
2️⃣2️⃣
Null-porotype object still has prototype types.

▶️ Playground
2️⃣3️⃣
Wrong behavior with array type intersections.

▶️ Playground
2️⃣4️⃣
Strange behavior with union of arrays.

▶️ Playground
2️⃣5️⃣
Weirdness with void type.

▶️ Playground