type-math
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

Type-Math

thanks to typescript 4.8, we can now do any math we want using string literals and then cast it back to a number

this enables many more possibilities for the actual calculations. For example:

import { M } from "type-math";

type T = M<1023904812930, "+", 13482194249>;
// => 1037387007179

which previously would never have been possible

Usage

type-math supports all the following operations with the M type:

  • Addition
  • Subtraction
  • Multiplication
  • Exponentiation
  • Division
  • Modulo
  • Greater Than
  • Greater Than or Equal To
  • Less Than
  • Less Than or Equal To
  • Equals

/type-math/

    Package Sidebar

    Install

    npm i type-math

    Weekly Downloads

    0

    Version

    0.0.0

    License

    MIT

    Unpacked Size

    22 kB

    Total Files

    13

    Last publish

    Collaborators

    • ggrandi