Comment by o11c
1 year ago
To be fair, that behavior on typescript's part is a major hole for bugs to slip through.
Specifically: absent optional keys + extra keys is fundamentally indistinguishable from miseptl keys.
1 year ago
To be fair, that behavior on typescript's part is a major hole for bugs to slip through.
Specifically: absent optional keys + extra keys is fundamentally indistinguishable from miseptl keys.
`interface` in TS allows extra keys, `type` does do not. Usually best to use `type` and add an intersection with some other type if you want extras (`Record<string,unknown>` is all right for arbitrary extra keys)
The current situation is worse, IMO. Lots of code that could be checked cannot, and lots of code that could have a more clearly defined interface does not.