How to use the tiny-decoders.boolean function in tiny-decoders

To help you get started, we’ve selected a few tiny-decoders examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lydell / tiny-decoders / typescript / decoders.ts View on Github external
mixedDict,
  number,
  optional,
  pair,
  record,
  string,
  triple,
  tuple,
} from "tiny-decoders";

function use(value: unknown) {
  return void value;
}

// $ExpectType boolean
boolean(undefined);
// $ExpectType number
number(undefined);
// $ExpectType string
string(undefined);
// $ExpectType readonly unknown[]
mixedArray(undefined);
// $ExpectType { readonly [key: string]: unknown; }
mixedDict(undefined);
// $ExpectType true
constant(true)(undefined);
// $ExpectType false
constant(false)(undefined);
// $ExpectType 0
constant(0)(undefined);
// $ExpectType "const"
constant("const")(undefined);