Created
December 16, 2024 10:46
-
-
Save mr-moon/e2d073fa7899d2aaedd55f739b50a778 to your computer and use it in GitHub Desktop.
A TypeScript type to deserialize JSON in a semi-safe way.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Primitive = | |
| bigint | |
| boolean | |
| null | |
| number | |
| string; | |
type JSONValue = Primitive | JSONObject | JSONArray; | |
type JSONArray = Array<JSONValue>; | |
export type JSONObject = Primitive | JSONArray | { | |
[key: string]: JSONValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment