macoolka-io
Version:
`macoolka-io` is Runtime type system for IO decoding/encoding.
28 lines (27 loc) • 680 B
TypeScript
/**
* Collection for Array
* @desczh
* 数组类型集合
* @file
*/
import * as t from 'io-ts';
import { NonEmptyArray } from 'fp-ts/NonEmptyArray';
/**
* @since 0.2.0
*/
export interface NonEmptyArrayC<C extends t.Mixed> extends t.Type<NonEmptyArray<t.TypeOf<C>>, Array<t.OutputOf<C>>, unknown> {
}
/**
* Get A non empty array
* @desczh
* 得到一个非空数组
* @example
* import { nonEmptyArray } from 'macoolka-io'
* import { isLeft } from 'fp-ts/Either'
*
* const input:string[] = []
* assert(isLeft(nonEmptyArray.decode(input)))
*
* @since 0.2.0
*/
export declare function nonEmptyArray<C extends t.Mixed>(codec: C, name?: string): NonEmptyArrayC<C>;