- [Encoder interface](#encoder-interface) - [Extracting static types from encoders](#extracting-static-types-from-encoders) # Encoder interface ```ts export interface Encoder { readonly encode: (a: A) => O } ``` **Example** An encoder representing a nullable value ```ts import * as E from 'io-ts/Encoder' export function nullable(or: E.Encoder): E.Encoder { return { encode: (a) => (a === null ? null : or.encode(a)) } } ``` # Extracting static types from encoders Static types can be extracted from encoders using the `OutputOf` operator ```ts const NumberToString: E.Encoder = { encode: String } type MyOutputType = E.OutputOf /* type MyOutputType = string */ ```