Skip to content

Instantly share code, notes, and snippets.

@MichalZalecki MichalZalecki/io-ts.ts Secret
Created Apr 23, 2019

Embed
What would you like to do?
const isString = (u: unknown): u is string => typeof u === "string";
// Type<A, O, I>
const string = new t.Type<string, string, unknown>(
"string",
isString,
(input, context) => isString(input) ? t.success(input) : t.failure(input, context),
t.identity,
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.