import * as tm from "type-mapping"; import {RouteData, Route} from "../route"; export type SetHeader = ( Route<{ readonly method : DataT["method"]; readonly path : DataT["path"]; readonly param : DataT["param"]; readonly query : DataT["query"]; readonly body : DataT["body"]; readonly header : F; readonly response : DataT["response"]; }> ); /** Your header mapper should handle the following types, `string|(string[])|undefined` */ export function setHeader ( data : DataT, f : F ) : SetHeader { return new Route<{ readonly method : DataT["method"]; readonly path : DataT["path"]; readonly param : DataT["param"]; readonly query : DataT["query"]; readonly body : DataT["body"]; readonly header : F; readonly response : DataT["response"]; }>({ ...data, header : f, }); }