A final (?) prototype for a refactor of mathjs, culminating the picomath, pocomath, typomath series. Provides an extensible core with "fuzzy" types for its operations, that can at any time generate exact .d.ts file for its current state.
Go to file
Glen Whitney ebe7cf831e refactor: Explore final patterns for runtime typing with ts-macros
The idea is to have a single macro which lets you reflect multiple
  implementations. That's provided in this commit. However, there
  is a hitch with implementations that have no dependencies: the
  reflectedType property did not exist on the Signature type. However,
  if you add it, then the Signature type becomes opaque, so we would
  have to look up signatures; but that appears to be tricky, as there
  doesn't seem to be a way to reflect the full generic type of the
  Signatures interface.

  So this commit provides three example resolutions:
  (A) Export a type RTT and all no-dependency implementations have to
      intersect with RTT (see 'add' in number/arithmetic.ts)
  (B) Write no-dependency implementations as functions of no arguments
      (representing no dependencies passed in) returning the actual
      implementation (see 'subtract' in number/arithmetic.ts)
  (C) Make a special DSignature<> generic type (short for "Direct Signature"
      used only (and always) for implementations with no dependencies, and
      a matching $Dreflect!() macro for generating their type info.

  Of course, there may be other possibilities I haven't thought of. But we
  need to pick one. I don't think it matters _too_ much, since there only
  a small fraction of all implementations have no dependencies.
2023-10-15 19:58:38 -07:00
etc feat: add build script (#13) 2023-08-23 03:20:10 +00:00
src refactor: Explore final patterns for runtime typing with ts-macros 2023-10-15 19:58:38 -07:00
.gitignore feat: add build script (#13) 2023-08-23 03:20:10 +00:00
.npmrc feat: add build script (#13) 2023-08-23 03:20:10 +00:00
LICENSE Initial commit 2022-12-02 14:04:53 +00:00
package.json5 feat: Add reflecTypes that allows multiple reflections at once 2023-10-09 21:10:15 -07:00
pnpm-lock.yaml feat: Add reflecTypes that allows multiple reflections at once 2023-10-09 21:10:15 -07:00
README.md feat: Precisely reflect the type of an implementation at runtime (!!) 2023-08-25 19:18:54 -07:00
tsconfig.json WIP: try to use ts-macros for more implementations 2023-09-18 10:14:11 -07:00

typocomath

A final (?) prototype for a refactor of mathjs, culminating the picomath, pocomath, typomath series. Provides an extensible core with "fuzzy" types for its operations, that can at any time generate exact .d.ts file for its current state.

Convenience scripts:

  • pnpm build -- compile the package
  • pnpm exec -- run the compiled code produced by pnpm build
  • pnpm go -- both of the above in sequence.

Important installation note:

after pnpm install, you must execute npx ts-patch install to activate the ts-macros compiler plugin.