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
2023-09-01 18:21:45 +02:00
src cleanup old experiments and typescript-rtti, update readme 2023-09-01 18:21:45 +02:00
.gitignore fix: generate CommonJS output instead of ESM as a workaround for typescript-rtti issue #94 2023-02-02 15:52:15 +01:00
LICENSE Initial commit 2022-12-02 14:04:53 +00:00
package.json5 cleanup old experiments and typescript-rtti, update readme 2023-09-01 18:21:45 +02:00
pnpm-lock.yaml cleanup old experiments and typescript-rtti, update readme 2023-09-01 18:21:45 +02:00
README.md cleanup old experiments and typescript-rtti, update readme 2023-09-01 18:21:45 +02:00
tsconfig.json cleanup old experiments and typescript-rtti, update readme 2023-09-01 18:21:45 +02: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.

To build and run the prototype, run:

pnpm install
pnpm build-and-run

experiment

Have a look at the section under /src/experiment and /src/plugins:

  • src/plugins/typeInferPlugin.ts is the actual plugin
  • in tsconfig.json we configure TypeScript to run the plugin
  • src/experiment/arithmeticInfer.ts with an example where we define __infer__
  • build/experiment/arithmeticInfer.ts where the __infer__ string literal is replace with the actual types

The idea

Create a TypeScript plugin which can replace a string literal like __infer__ in a typed-function definition:

typed('square', '__infer__', <T>(dep: { ... } => { ... })

with the actual types, something like:

typed('square', '{ deps: { multiply: (a: T, b: T) => T; }; return: (a: T) => T }', <T>(dep: { ... } => { ... })

(We can discuss what syntax we like most, this is just a POC)

How to run

pnpm build-and-run

Read more

Interesting libraries