@inlang/json-types

1.1.0 • Public • Published

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(),
	}),
)

Readme

Keywords

none

Package Sidebar

Install

npm i @inlang/json-types

Weekly Downloads

9,335

Version

1.1.0

License

Apache-2.0

Unpacked Size

51.7 kB

Total Files

14

Last publish

Collaborators

  • inlangbot
  • samuelstroschein