io-ts-types
Version:
A collection of codecs and combinators for use with io-ts
23 lines (22 loc) • 668 B
TypeScript
/**
* @since 0.4.4
*/
import * as t from 'io-ts'
/**
* @since 0.4.4
*/
export interface IntFromStringC extends t.Type<t.Int, string, unknown> {}
/**
* A codec that succeeds if a string can be parsed to an integer
*
* @example
* import { IntFromString } from 'io-ts-types/lib/IntFromString'
* import { right } from 'fp-ts/lib/Either'
* import { PathReporter } from 'io-ts/lib/PathReporter'
*
* assert.deepStrictEqual(IntFromString.decode('1'), right(1))
* assert.deepStrictEqual(PathReporter.report(IntFromString.decode('1.1')), ['Invalid value "1.1" supplied to : IntFromString'])
*
* @since 0.4.4
*/
export declare const IntFromString: IntFromStringC