feat: Narrow tsc typing of operation dependencies/implementations
This commit is contained in:
parent
90b66dc863
commit
f575582879
19 changed files with 912 additions and 111 deletions
20
src/interfaces/arithmetic.ts
Normal file
20
src/interfaces/arithmetic.ts
Normal 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>)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue