Skip to content

AshGreyG/Algorithm-TsTs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<?:>

👾 What is TsTs

TsTs (TypeScript Type System) is a turing-complete language that can do anything other normal languages do. For example, TsTs can emulate the operations between integers like:

type Opposite<A extends number>
  = IsZero<A> extends true
    ? 0
    : `${A}` extends `-${infer OA extends number}`
      ? OA
      : `-${A}` extends `${infer OA extends number}`
        ? OA
        : never;

Recurse lets TsTs become a turing-complete language.

🚨 Notice

The Integer module of TsTs hasn't implemented methods of exponential numbers, hexadecimal , octal, and binary. It's only served for decimals. It's different from JavaScript number system, please be careful. Dealing with these numbers is complicated and NOT worthful. You only need them as string format.

type A = Integer.ToString<12>;    // "12"
type B = Integer.ToString<0x12>;  // "18", expected as "0x12" for me.
type C = Integer.ToString<1e+10>; // "10000000000"

About

♟️🤖 Useful algorithms implemented by TsTs (TypeScript Type System)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published