3 ms·
I solve this issue by leveraging the type-system to force me to enumerate all of the keys I expect to iterate over at compile time, i.e. knownKeys(o, ["x",
by webstrand 3y ago
I solve this issue by leveraging the type-system to force me to enumerate all of the keys I expect to iterate over at compile time, i.e.
knownKeys(o, ["x", "y"]); // returns ["x", "y"]
Excess keys are not an issue, because they are ignored. And if I fail to list a key that the compiler knows about, the compiler will complain.
https://tsplay.dev/WKvkzm https://tsplay.dev/WKvkzm