diff --git a/gulpfile.ts b/gulpfile.ts index d628303..88e7c27 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -179,20 +179,11 @@ function get_top_level_members(filename: string): dts.ITopLevelMember[] { throw new Error(`Exported functions in ${filename} should be prefixed with $`); } - const placeholder_imports = - (functions[0].type!.parameters!.length <= 1) - ? [] - : [ - dts.create_import_named({ - from: './$placeholder', - members: [ - dts.create_import_member({ - name: placeholder_name_abbr, - property: placeholder_name, - }), - ], - }), - ]; + const placeholder_imports = (!placeholder || functions[0].type!.parameters!.length <= 1) + ? [] + : dts.parse(` + import {${placeholder_name} as ${placeholder_name_abbr}} from './$placeholder'; + `).members; const curried_declarations = create_curried_declarations( filename, diff --git a/templates/$curried-functions.ts b/templates/$curried-functions.ts index 21696f5..7ab7842 100644 --- a/templates/$curried-functions.ts +++ b/templates/$curried-functions.ts @@ -5,16 +5,14 @@ import {create_curried_interfaces} from './utils/create-curried-interfaces'; export const max_curry_level = 6; export default (selectable: boolean, placeholder: boolean) => [ - dts.create_import_named({ - members: [ - dts.create_import_member({ - name: placeholder_name_abbr, - property: placeholder_name, - }), - ], - from: './$placeholder', - }), - ...dts.parse(`export type CurriedFunction0 = () => R;`).members, + ...dts.parse(` + ${ + placeholder + ? `import {${placeholder_name} as ${placeholder_name_abbr}} from './$placeholder';` + : '' + } + export type CurriedFunction0 = () => R; + `).members, ...create_curried_interfaces(max_curry_level, selectable, placeholder).map( the_interface => ({ ...the_interface,