/** * @since 0.5.2 */ import { AnyNewtype, CarrierOf } from 'newtype-ts' import * as t from 'io-ts' /** * Returns a codec from a newtype * * @example * import { fromNewtype } from 'io-ts-types/lib/fromNewtype' * import * as t from 'io-ts' * import { right } from 'fp-ts/lib/Either' * import { PathReporter } from 'io-ts/lib/PathReporter' * import { Newtype, iso } from 'newtype-ts' * * interface Token extends Newtype<{ readonly Token: unique symbol }, string> {} * * const T = fromNewtype(t.string) * * assert.deepStrictEqual(T.decode('sometoken'), right(iso().wrap('sometoken'))) * assert.deepStrictEqual(PathReporter.report(T.decode(42)), ['Invalid value 42 supplied to : fromNewtype(string)']) * * @since 0.5.2 */ export declare function fromNewtype( codec: t.Type, t.OutputOf>>, name?: string ): t.Type, unknown>