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
Jos de Jong 6a063d7385 Add a useful resource to the list with articles 2023-03-14 10:15:56 +01:00
src Add another experiment infer2 (WIP) 2023-03-14 09:51:28 +01: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
README.md Add a useful resource to the list with articles 2023-03-14 10:15:56 +01:00
package.json5 Add another experiment infer2 (WIP) 2023-03-14 09:51:28 +01:00
pnpm-lock.yaml chore: switch to the `typescript` and `typescript-rtti` versions used in the online playground 2023-02-02 15:07:47 +01:00
tsconfig.json fix: generate CommonJS output instead of ESM as a workaround for typescript-rtti issue #94 2023-02-02 15:52:15 +01:00

README.md

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

See: the section under /src/experiment and /src/plugins.

The idea

Create a TypeScript plugin which can replace structures like:

infer(factoryFunction)

where factoryFunction is a mathjs factory function in TypeScript, with something like:

infer({ signature: factoryFunction })

where signature is a string containing the type of the factory function and its dependencies.

Relevant methods of the TypeScript compiler are:

const program = ts.createProgram(fileNames, options)
const typeChecker = program.getTypeChecker()

// relevant methods:
//
//   typeChecker.getSymbolAtLocation
//   typeChecker.getTypeOfSymbolAtLocation
//   typeChecker.getResolvedSignature
//   typeChecker.getSignaturesOfType

Status

None of the experiments (infer1 and infer2) are outputting something useful yet.

How to run

pnpm experiment:infer1
pnpm experiment:infer1-direct
pnpm experiment:infer2

Read more