Skip to content

NeaByteLab/Typebox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typebox

Contract language for TypeScript where programs are typed contracts

Deno JSR License

Installation

Note

Prerequisites: Install Deno from deno.com.

Deno (via JSR):

deno add jsr:@neabyte/typebox

Or import directly from JSR:

import { Define, Loader } from 'jsr:@neabyte/typebox'

Quick Start

import { Define, Loader } from '@neabyte/typebox'

const app = Loader({
  add: Define((props: { a: number; b: number }) => props.a + props.b),
  counter: Define.state(0, (count, amount: number) => count + amount)
})

app.add({ a: 2, b: 3 }) // 5
app.counter(5) // 5
app.counter.get() // 5

Read docs/README.md for full documentation.

Testing

Type check - format, lint, and type-check:

deno task check

Unit tests - format/lint tests and run all tests:

deno task test
  • Tests live under tests/ (globals, utils, helpers, and index tests).
  • The test task uses --allow-read, --allow-write, and --allow-env.

License

This project is licensed under the MIT license. See the LICENSE file for details.