How to use the tiny-decoders.deep 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
errors.slice();
  }
});

deep([], string);
deep([""], string);
deep([0], string);
// Wrong key type:
// $ExpectError
deep([null], string);
// Wrong order:
// $ExpectError
deep(string, []);
// Missing path:
// $ExpectError
deep(string);

// Decoder instead of `() => decoder`:
// $ExpectError
lazy(string);
github lydell / tiny-decoders / typescript / decoders.ts View on Github external
tuple((item, itemError, arr, errors) => {
  arr.slice();
  // arr is an array, not an object.
  // $ExpectError
  use(arr.test);
  // errors can be null.
  // $ExpectError
  errors.slice();
  if (errors != null) {
    errors.slice();
  }
});

deep([], string);
deep([""], string);
deep([0], string);
// Wrong key type:
// $ExpectError
deep([null], string);
// Wrong order:
// $ExpectError
deep(string, []);
// Missing path:
// $ExpectError
deep(string);

// Decoder instead of `() => decoder`:
// $ExpectError
lazy(string);