typescript definition generator for functional programming
npm install dts-element-fp


typescript definition generator for functional programming
Changelog - Examples - Documentation
``shusing npm
npm install --save-dev dts-element-fp dts-element
Usage
`ts
import * as dts from 'dts-element';
import * as dts_fp from 'dts-element-fp';const curried_interfaces = dts_fp.create_curried_interfaces(3);
dts.emit(curried_interfaces); /*=>
interface CurriedFunction1 {
(v1: T1): R;
}
interface CurriedFunction2 {
(v1: T1): CurriedFunction1;
(v1: T1, v2: T2): R;
}
interface CurriedFunction3 {
(v1: T1): CurriedFunction2;
(v1: T1, v2: T2): CurriedFunction1;
(v1: T1, v2: T2, v3: T3): R;
}
*/
const curried_declarations_normal = dts_fp.create_curried_declarations(
'append',
dts.parse_type('(value: T, list: List) => (T | U)[]'),
);
dts.emit(curried_declarations_normal); /*=>
declare const append: append_00;
type append_00 = {
(value: T): append_10;
(value: T, list: List): append_11;
};
type append_10 = {
(list: List): append_11;
};
type append_11 = (T | U)[];
*/
const curried_declarations_various = dts_fp.create_curried_declarations(
'map',
{
list: dts.parse_type('(fn: (x: T) => U, list: List) => U[]'),
functor: dts.parse_type('(fn: (x: T) => U, functor: Functor) => Functor'),
},
);
dts.emit(curried_declarations_various); /*=>
declare const map: map_00;
type map_00 = {
(fn: (x: T) => U): map_10;
(fn: (x: T) => U, list: List): map_list_11;
(fn: (x: T) => U, functor: Functor): map_functor_11;
};
type map_10 = {
(list: List): map_list_11;
(functor: Functor): map_functor_11;
};
type map_list_11 = U[];
type map_functor_11 = Functor;
*/
`See Documentation for more options.
Development
`sh
lint
yarn run lintbuild
yarn run buildtest
yarn run test
``- dts-element - A DOM library for generation TypeScript declaration (.d.ts) files
MIT © Ika