Skip to content
Snippets Groups Projects
Commit a4714f32 authored by Loïc Correnson's avatar Loïc Correnson
Browse files

[ivette] better api doc

parent 1fb9b98c
No related branches found
No related tags found
No related merge requests found
......@@ -52,17 +52,23 @@ export function pretty(js: any) {
/** Decoder for values of type `D`.
You can abbreviate `Safe<D | undefined>` with `Loose<D>`. */
export type Safe<D> = (js?: json) => D;
export interface Safe<D> {
(js?: json): D;
}
/** Decoder for values of type `D`, if any.
Same as `Safe<D | undefined>`. */
export type Loose<D> = (js?: json) => D | undefined;
export interface Loose<D> {
(js?: json): D | undefined;
}
/**
Encoder for value of type `D`.
In most cases, you only need [[identity]].
*/
export type Encoder<D> = (v: D) => json;
export interface Encoder<D> {
(v: D): json;
}
/** Can be used for most encoders. */
export function identity<A>(v: A): A { return v; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment