How to use the decoders.instanceOf function in decoders

To help you get started, we’ve selected a few 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 nvie / decoders / src / types / instanceOf-tests.ts View on Github external
import { instanceOf } from 'decoders';

// $ExpectType Decoder
instanceOf(Error);

// $ExpectType Decoder
instanceOf(TypeError);

// $ExpectType Decoder
instanceOf(RegExp);

// $ExpectType Decoder, unknown>
instanceOf>(Promise);

// $ExpectError
instanceOf>(Set);
github nvie / decoders / src / types / instanceOf-tests.ts View on Github external
import { instanceOf } from 'decoders';

// $ExpectType Decoder
instanceOf(Error);

// $ExpectType Decoder
instanceOf(TypeError);

// $ExpectType Decoder
instanceOf(RegExp);

// $ExpectType Decoder, unknown>
instanceOf>(Promise);

// $ExpectError
instanceOf>(Set);
github nvie / decoders / src / types / instanceOf-tests.ts View on Github external
import { instanceOf } from 'decoders';

// $ExpectType Decoder
instanceOf(Error);

// $ExpectType Decoder
instanceOf(TypeError);

// $ExpectType Decoder
instanceOf(RegExp);

// $ExpectType Decoder, unknown>
instanceOf>(Promise);

// $ExpectError
instanceOf>(Set);
github nvie / decoders / src / types / instanceOf-tests.ts View on Github external
import { instanceOf } from 'decoders';

// $ExpectType Decoder
instanceOf(Error);

// $ExpectType Decoder
instanceOf(TypeError);

// $ExpectType Decoder
instanceOf(RegExp);

// $ExpectType Decoder, unknown>
instanceOf>(Promise);

// $ExpectError
instanceOf>(Set);
github nvie / decoders / src / types / instanceOf-tests.ts View on Github external
import { instanceOf } from 'decoders';

// $ExpectType Decoder
instanceOf(Error);

// $ExpectType Decoder
instanceOf(TypeError);

// $ExpectType Decoder
instanceOf(RegExp);

// $ExpectType Decoder, unknown>
instanceOf>(Promise);

// $ExpectError
instanceOf>(Set);
github nvie / decoders / src / types / typescript-tests.ts View on Github external
a7: tuple6(hardcoded('foo'), mixed, null_, undefined_, unknown, truthy),
        a8: tuple4(integer, number, positiveInteger, positiveNumber),
        a9: either(boolean, numericBoolean),
        b0: map(
            compose(
                string,
                predicate(s => s.startsWith('x'), 'Must start with x')
            ),
            s => s.toUpperCase()
        ),
        b1: shape,
        b2: date,
        b3: dict(string),
        b4: mapping(string),
        b5: oneOf(['foo', 'bar']),
        b6: instanceOf(TypeError),
    }),
    { style: 'simple' }
)('blah');