feat: Narrow tsc typing of operation dependencies/implementations

This commit is contained in:
Glen Whitney 2024-09-29 13:48:06 -07:00
parent 90b66dc863
commit f575582879
19 changed files with 912 additions and 111 deletions

View file

@ -0,0 +1,20 @@
import type {ClosureType, NaNType, RealType} from './type'
type UnOp<T> = (a: T) => T
type BinOp<T> = (a: T, B: T) => T
declare module "./type" {
interface CommonInterface<T, Aux> {
add: BinOp<T>
unaryMinus: UnOp<T>
conj: UnOp<T>
subtract: BinOp<T>
multiply: BinOp<T>
square: UnOp<T>
absquare: (a: T) => RealType<T>
reciprocal: UnOp<T>
divide: BinOp<T>
conservativeSqrt: (a: T) => (T | NaNType<T>)
sqrt: (a: T) => (T | ClosureType<T>)
}
}