UNPKG

872 BTypeScriptView Raw
1/**
2 * @since 0.4.5
3 */
4import * as t from 'io-ts'
5/**
6 * @since 0.4.5
7 */
8export interface NonEmptyStringBrand {
9 readonly NonEmptyString: unique symbol
10}
11/**
12 * @since 0.4.5
13 */
14export declare type NonEmptyString = t.Branded<string, NonEmptyStringBrand>
15/**
16 * @since 0.4.5
17 */
18export interface NonEmptyStringC extends t.Type<NonEmptyString, string, unknown> {}
19/**
20 * A codec that succeeds if a string is not empty
21 *
22 * @example
23 * import { NonEmptyString } from 'io-ts-types/lib/NonEmptyString'
24 * import { right } from 'fp-ts/lib/Either'
25 * import { PathReporter } from 'io-ts/lib/PathReporter'
26 *
27 * assert.deepStrictEqual(NonEmptyString.decode('a'), right('a'))
28 * assert.deepStrictEqual(PathReporter.report(NonEmptyString.decode('')), ['Invalid value "" supplied to : NonEmptyString'])
29 *
30 * @since 0.4.5
31 */
32export declare const NonEmptyString: NonEmptyStringC