Created
October 1, 2018 15:23
-
-
Save miyaokamarina/9c8ae3aff2d847675ce9df0d302d27ea to your computer and use it in GitHub Desktop.
Safe JSON type in TypeScript
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
interface JsonArray extends Array<JsonValue> {} | |
interface JsonObject { | |
[key: string]: JsonValue; | |
} | |
export type JsonValue = null | boolean | number | string | JsonArray | JsonObject; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment