chore: Remove use of ts-macros (#3)

Plan is to use a custom build step instead.

Reviewed-on: #3
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2024-10-15 06:53:08 +00:00 committed by Glen Whitney
parent 2a7723df68
commit 239215c234
7 changed files with 19 additions and 178 deletions

View file

@ -2,7 +2,7 @@ import {Complex} from './type.js'
import {implementations, commonSpecs} from '@/core/Dispatcher'
import type {RawDependencies} from '@/core/Dispatcher'
import {commonSignature, RealType, $reflect} from '@/interfaces/type'
import {commonSignature, RealType} from '@/interfaces/type'
import type {CommonSignature, CommonReturn} from '@/interfaces/type'
// Narrowly typed signature selectors, for the operations we need to use
@ -150,5 +150,3 @@ export function mixed<T>() {
})
.ship()
}
$reflect!([common, mixed])

View file

@ -1,6 +1,5 @@
import {implementations, commonSpecs} from '@/core/Dispatcher'
import {joinTypes} from '@/core/type'
import {$reflect} from '@/interfaces/type'
import type {
CommonInterface, CommonSignature, NaNType, OneType, ZeroType
@ -70,5 +69,3 @@ export function common<T>() {
})
.ship()
}
$reflect!([common, lift])

View file

@ -1,5 +1,3 @@
import {$$typeToString} from 'ts-macros'
import {Configuration} from '@/core/Configuration'
/* First some type utilities: */
@ -116,11 +114,3 @@ export type Dependency<T, Aux = T> = {
export type Dependencies<T, Names extends SignatureKey<T>, Aux = T> =
Pick<CommonSignature<T, Aux>, Names>
// Macro for type reflection:
export function $reflect<ImplTuple>(tup: ImplTuple) {
+[[tup], <T>(elt: T) => {
(elt as {reflectedType: string}).reflectedType
= $$typeToString!<T>(true, false, true);
}]
}

View file

@ -1,5 +1,4 @@
import {implementations} from '@/core/Dispatcher'
import {$reflect} from '@/interfaces/type'
import type {CommonSignature} from '@/interfaces/type'
const conservativeSqrt = (a: number) => isNaN(a) ? NaN : Math.sqrt(a)
@ -25,5 +24,3 @@ export const common = implementations<CommonSignature<number>>()
}
}})
.ship()
$reflect!([common])

View file

@ -1,6 +1,5 @@
import type {Complex} from '@/Complex/type'
import {implementations} from '@/core/Dispatcher'
import {$reflect} from '@/interfaces/type'
import type {CommonSignature} from '@/interfaces/type'
export const number_type = {
@ -30,5 +29,3 @@ export const common = implementations<CommonSignature<number>>()
nan: a => NaN,
re: a => a
}).ship()
$reflect!([common])