@inlang/json-types
v1.1.0
Published
JSON types that are used across inlang's codebase (and hopefully useful to external developers as well!).
Downloads
89,494
Readme
JSON types that are used across inlang's codebase (and hopefully useful to external developers as well!).
Usage
As type
Importing any JSONObject as type
will prune runtime validation code.
import type { JSONObject } from "@inlang/json-types"
type MyType = JSONObject<{
foo: string
bar: number
}>
Validation
Every JSONObject is defined as JSONSchema with typebox and can be used for validation
import { JSONObject } from "@inlang/json-types"
const isValid = someJsonSchemaValidator(
JSONObject({
foo: string(),
bar: number(),
}),
)