UNPKG

668 BTypeScriptView Raw
1/**
2 * @since 0.4.4
3 */
4import * as t from 'io-ts'
5/**
6 * @since 0.4.4
7 */
8export interface IntFromStringC extends t.Type<t.Int, string, unknown> {}
9/**
10 * A codec that succeeds if a string can be parsed to an integer
11 *
12 * @example
13 * import { IntFromString } from 'io-ts-types/lib/IntFromString'
14 * import { right } from 'fp-ts/lib/Either'
15 * import { PathReporter } from 'io-ts/lib/PathReporter'
16 *
17 * assert.deepStrictEqual(IntFromString.decode('1'), right(1))
18 * assert.deepStrictEqual(PathReporter.report(IntFromString.decode('1.1')), ['Invalid value "1.1" supplied to : IntFromString'])
19 *
20 * @since 0.4.4
21 */
22export declare const IntFromString: IntFromStringC