UNPKG

716 BTypeScriptView Raw
1/**
2 * @since 0.4.6
3 */
4import * as t from 'io-ts'
5/**
6 * @since 0.4.6
7 */
8export interface UUIDBrand {
9 readonly UUID: unique symbol
10}
11/**
12 * @since 0.4.6
13 */
14export declare type UUID = t.Branded<string, UUIDBrand>
15/**
16 * @example
17 * import { UUID } from 'io-ts-types/lib/UUID'
18 * import { right } from 'fp-ts/lib/Either'
19 * import { PathReporter } from 'io-ts/lib/PathReporter'
20 *
21 * assert.deepStrictEqual(UUID.decode('00000000-0000-0000-0000-000000000000'), right('00000000-0000-0000-0000-000000000000'))
22 * assert.deepStrictEqual(PathReporter.report(UUID.decode('not a uuid')), ['Invalid value "not a uuid" supplied to : UUID'])
23 *
24 * @since 0.4.6
25 */
26export declare const UUID: t.BrandC<t.StringC, UUIDBrand>