@nxtedition/types

1.6.14 • Public • Published

@nxtedition/types

Description

This package contains:

  • TypeScript types to be shared between nxtedition packages.
  • Runtime validatiors and JSON functions for those types.

Usage

Import types and validators like this in TypeScript:

import type { TemplateRecord } from '@nxtedition/types'
import { isTemplateRecord } from '@nxtedition/types'

const templateRecord: TemplateRecord = { ... }


And like this in JavaScript:

```javascript
import { isTemplateRecord } from '@nxtedition/types'

/**
 * @typedef { import("@nxtedition/types").TemplateRecord } TemplateRecord
 */

/** @type {TemplateRecord} */
const templateRecord = { ... }

If bundle size is an issue, you can import only the parts you need like this:

import { isTemplateRecord } from '@nxtedition/types/domains/template'

Development

Generate runtime code

Generally, we only manually specify types in this package. A code generator is used to generate the runtime validators and JSON functions. It will do so for all types that are exported. To run the generator, use the following command:

yarn build

This will build the output to the dist directory.

Exports

We export all types up to the root of the package, so they can be imported directly from @nxtedition/types. This means that all exported types must be uniquely named.

Readme

Keywords

none

Package Sidebar

Install

npm i @nxtedition/types

Weekly Downloads

24

Version

1.6.14

License

MIT

Unpacked Size

2.21 MB

Total Files

52

Last publish

Collaborators

  • qtoden
  • phillipjacob
  • deadbeef84
  • tobiasandersen
  • ronag
  • nxtadmin