1 | /**
|
2 | * @since 0.5.0
|
3 | */
|
4 | import * as t from 'io-ts'
|
5 | /**
|
6 | * Returns a clone of the given codec that always succeed using the given value `a` if the original codec fails
|
7 | *
|
8 | * @example
|
9 | * import { withFallback } from 'io-ts-types/lib/withFallback'
|
10 | * import * as t from 'io-ts'
|
11 | * import { right } from 'fp-ts/lib/Either'
|
12 | *
|
13 | * const T = withFallback(t.number, -1)
|
14 | *
|
15 | * assert.deepStrictEqual(T.decode(1), right(1))
|
16 | * assert.deepStrictEqual(T.decode('a'), right(-1))
|
17 | *
|
18 | * @since 0.5.0
|
19 | */
|
20 | export declare function withFallback<C extends t.Any>(codec: C, a: t.TypeOf<C>, name?: string): C
|
21 |
|
\ | No newline at end of file |