Created
January 27, 2021 16:06
-
-
Save urain39/5588e35fdb87f159331f5576698516a1 to your computer and use it in GitHub Desktop.
JSON Type annotation for 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 IMap<V> { | |
[key: string]: V | V[]; | |
[index: number]: V | V[]; | |
} | |
type JSONPrimitiveType = number | string | boolean | null; | |
interface JSONObjectType extends IMap<JSONPrimitiveType | JSONObjectType> {}; | |
interface JSONArrayType extends Array<JSONPrimitiveType | JSONObjectType | JSONArrayType> {}; | |
export type JSONType = JSONPrimitiveType | JSONObjectType | JSONArrayType; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment