This repository has been archived on 2026-03-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

18 lines
601 B
TypeScript

import { Type } from "../type";
import { typeOf } from "./type-of";
import { value } from "./value";
export const num = typeOf<number>('number');
export const bigint = typeOf<bigint>('bigint');
export const str = typeOf<string>('string');
export const bool = typeOf<boolean>('boolean');
export const fn = typeOf<Function>('function');
export const sym = typeOf<Symbol>('symbol');
export const undef = typeOf<undefined>('undefined');
export const nil = value<null>(null);
export const obj = typeOf<Object>('object');
export function maybe<T>(check: Type<T>): Type<T|null> {
return check.or(nil);
}