| ▲ | 01HNNWZ0MV43FF 16 hours ago |
| 3 of those 4 examples wouldn't exist in a statically-typed language like TypeScript |
|
| ▲ | ants_everywhere 15 hours ago | parent [-] |
| Yes this is just ad hoc runtime type checking |
| |
| ▲ | mewpmewp2 15 hours ago | parent [-] | | Alternative -> could just use something like Zod or have native stdlib Zod like type of thing to improve a lot on this type of edge case handling. Although if performance is key, then might question how much this constant parsing and validation would add on top, but in 99% cases probably wouldn't matter. |
|