Skip to content

marinp1/advanced-types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playground of "advanced" TypeScript types

Created originally for AoC 2022, might post solutions later (managed to do ~10 first days with types).

The repository contains a bunch of types that might or might not work, but feel free to check the other files as well that are not described below.

Sum two numbers together:

There are two ways of summing numbers together:

SimpleSum

SimpleSum type works by appending elements to array and accessing ['length'] property of the said array.

Limited to 1000 due to recursion limits.

Simple Sum Example

Sum

Sum type works by transforming and translating strings.

Sum Example

Subtract one number from another:

Minus Example

Works also for negative values:

Minus Neg Example

Summation and subtraction can also be chained in a natural expression with Expression type:

Expression Example

Divide two numbers:

Returns whole division and remainder.

Division Example

Multiplies two numbers together.

Multiplication Example

List of numbers can be sorted with SortByAscendingOrder type. Tried to implement quicksort and it works quite well.

Does not work with negative numbers (those are appended to the end of list atm).

Sort Example

About

Stupid things that are possible with typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published