import type { Signature } from '../interfaces/type.js' import {$reflect} from '../interfaces/type.js' export const number_type = { name: 'number', // just until we have reflection to tell us before: ['Complex'], test: (n: unknown): n is number => typeof n === 'number', from: { string: (s: string) => +s } } declare module "../interfaces/type" { interface AssociatedTypes { number: { type: number zero: 0 one: 1 nan: typeof NaN real: number } } } // I don't like the redundancy of repeating 'zero'; any way to eliminate that? export const zero = (): Signature<'zero', number> => (a) => 0 export const one = (): Signature<'one', number> => (a) => 1 export const nan = (): Signature<'nan', number> => (a) => NaN export const re = (): Signature<'re', number> => (a) => a $reflect!([zero, one, nan, re])