Skip to content

Instantly share code, notes, and snippets.

View Katerina198b's full-sized avatar

Ekaterina Zakharenkova Katerina198b

  • Warsaw
View GitHub Profile
@dfoverdx
dfoverdx / Permutations.ts
Last active February 7, 2023 14:20
TypeScript Permutations Type
/**
* @document Permutations.ts
*
* I wanted to figure out, just for the challenge of it, whether I could, given an array type `A`, produce a type that
* matches any array with every element of `A` exactly once in any order. I *love* abusing the TS typing engine. It
* insulted my mother once.
*/
/**
* Returns an array type that includes every element of `T` exactly once in any order.
find <folder>/ -name '*.icloud' -delete
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Early returns comparison</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>