feat: Add reflecTypes that allows multiple reflections at once
This commit is contained in:
parent
457b9cdc91
commit
49b1332917
@ -23,12 +23,12 @@
|
||||
url: 'https://code.studioinfinity.org/glen/typocomath.git',
|
||||
},
|
||||
devDependencies: {
|
||||
'@types/node': '20.8.0',
|
||||
'@types/node': '20.8.4',
|
||||
'cpy-cli': '5.0.0',
|
||||
'del-cli': '5.1.0',
|
||||
mkdirp: '3.0.1',
|
||||
'source-map': '0.7.4',
|
||||
'ts-macros': '2.5.0',
|
||||
'ts-macros': '2.6.0',
|
||||
'ts-patch': '3.0.2',
|
||||
typescript: '5.1.6',
|
||||
},
|
||||
|
@ -6,8 +6,8 @@ settings:
|
||||
|
||||
devDependencies:
|
||||
'@types/node':
|
||||
specifier: 20.8.0
|
||||
version: 20.8.0
|
||||
specifier: 20.8.4
|
||||
version: 20.8.4
|
||||
cpy-cli:
|
||||
specifier: 5.0.0
|
||||
version: 5.0.0
|
||||
@ -21,8 +21,8 @@ devDependencies:
|
||||
specifier: 0.7.4
|
||||
version: 0.7.4
|
||||
ts-macros:
|
||||
specifier: 2.5.0
|
||||
version: 2.5.0(typescript@5.1.6)
|
||||
specifier: 2.6.0
|
||||
version: 2.6.0(typescript@5.1.6)
|
||||
ts-patch:
|
||||
specifier: 3.0.2
|
||||
version: 3.0.2
|
||||
@ -79,8 +79,10 @@ packages:
|
||||
resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==}
|
||||
dev: true
|
||||
|
||||
/@types/node@20.8.0:
|
||||
resolution: {integrity: sha512-LzcWltT83s1bthcvjBmiBvGJiiUe84NWRHkw+ZV6Fr41z2FbIzvc815dk2nQ3RAKMuN2fkenM/z3Xv2QzEpYxQ==}
|
||||
/@types/node@20.8.4:
|
||||
resolution: {integrity: sha512-ZVPnqU58giiCjSxjVUESDtdPk4QR5WQhhINbc9UBrKLU68MX5BF6kbQzTrkwbolyr0X8ChBpXfavr5mZFKZQ5A==}
|
||||
dependencies:
|
||||
undici-types: 5.25.3
|
||||
dev: true
|
||||
|
||||
/@types/normalize-package-data@2.4.1:
|
||||
@ -843,8 +845,8 @@ packages:
|
||||
engines: {node: '>=12'}
|
||||
dev: true
|
||||
|
||||
/ts-macros@2.5.0(typescript@5.1.6):
|
||||
resolution: {integrity: sha512-Uha8rei70+YtQS7nJ1F9m4BVUUV78vky3hIeH6JaHo2cqrKFpA9VWKzkzt4CAQU7g1pheNKr0iOkBmCzrKy2jw==}
|
||||
/ts-macros@2.6.0(typescript@5.1.6):
|
||||
resolution: {integrity: sha512-X7c4rHPTpBYY+MJUkIDIQMbTPAcv1y1sylrnDMsTvcbImleT4Wlheg3wNbORwnX8Zvq2ldZnttNXcZ1a0VE2Kg==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
typescript: 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x
|
||||
@ -876,6 +878,10 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/undici-types@5.25.3:
|
||||
resolution: {integrity: sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==}
|
||||
dev: true
|
||||
|
||||
/validate-npm-package-license@3.0.4:
|
||||
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
|
||||
dependencies:
|
||||
|
@ -91,3 +91,8 @@ export function $reflect<Impl>(name: string, expr: Impl) : Impl & { reflectedTyp
|
||||
export function $reflecType<Impl>(expr: Impl) {
|
||||
expr.reflectedType = $$typeToString!<Impl>(true, false, true);
|
||||
}
|
||||
|
||||
export function $reflecTypes<ImplTuple>(tup: ImplTuple) {
|
||||
+[[tup], <T>(elt: T) =>
|
||||
elt.reflectedType = $$typeToString!<T>(true, false, true)]
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import type {configDependency} from '../core/Config.js'
|
||||
import type {Dependencies, Signature} from '../interfaces/type.js'
|
||||
import { $reflecType } from '../interfaces/type.js'
|
||||
import { $reflecType, $reflecTypes } from '../interfaces/type.js'
|
||||
|
||||
export const add: Signature<'add', number> = (a, b) => a + b
|
||||
export const add /*: Signature<'add', number>*/ = (a, b) => a + b
|
||||
export const unaryMinus: Signature<'unaryMinus', number> = a => -a
|
||||
export const conj: Signature<'conj', number> = a => a
|
||||
export const subtract: Signature<'subtract', number> = (a, b) => a - b
|
||||
export const conj /*: Signature<'conj', number>*/ = a => a
|
||||
export const subtract /*: Signature<'subtract', number>*/ = (a, b) => a - b
|
||||
export const multiply: Signature<'multiply', number> = (a, b) => a * b
|
||||
export const absquare: Signature<'absquare', number> = a => a * a
|
||||
export const reciprocal: Signature<'reciprocal', number> = a => 1 / a
|
||||
@ -25,5 +25,6 @@ export const sqrt =
|
||||
if (a >= 0) return Math.sqrt(a)
|
||||
return dep.complex(0, Math.sqrt(unaryMinus(a)))
|
||||
}
|
||||
}
|
||||
}
|
||||
$reflecType!(sqrt)
|
||||
$reflecTypes!([add, conj, subtract])
|
||||
|
Loading…
Reference in New Issue
Block a user