DEV Community

Lukas Gaucas
Lukas Gaucas

Posted on • Updated on

TypeScript for prototyping: bijective function example with generics' notation

Bijective function (one-to-one correspondence) function in layman's terms with TypeScript generic notation:

function bijective<input, output>(arg1: input, arg2: output): void /* <= instead of "return;" do "void" */ {
   /* return; */

bijective<number,boolean>(0, false) // #  "0=>false" 
bijective<number,boolean>(1, true) // # "1=>true" 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)