Package Exports
- newtype-ts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (newtype-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Usage
import { Newtype, iso } from 'newtype-ts'
type Age = Newtype<'Age', number>
const ageIso = iso<Age>()
// age: Newtype<"Age", number>
const age = ageIso.wrap(43)
// n: number
const n = ageIso.unwrap(age)
declare function f(age: Age): void
f(43) // error: Argument of type '43' is not assignable to parameter of type 'Newtype<"Age", number>'
f(age)