Use stricter type for JsonObject
Closed this issue · 2 comments
gajus commented
JsonObject
that comes from 'type-fest' (annoyingly) includes undefined as valid value, which is not the case for json.
A better definition would be:
type JsonObject = { [key: string]: JsonValue, };
type JsonValue = JsonObject | JsonValue[] | boolean | number | string | null;
sindresorhus commented
JsonObject that comes from 'type-fest' (annoyingly) includes undefined as valid value
It does not. It allows optional keys. You might want to use the exactOptionalPropertyTypes
flag.
sindresorhus commented
Context: sindresorhus/type-fest#65