Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
fix(template): remove unnecessary importing placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatyang committed Jun 28, 2017
1 parent 580ed90 commit 90af411
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
19 changes: 5 additions & 14 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 8 additions & 10 deletions templates/$curried-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> = () => R;`).members,
...dts.parse(`
${
placeholder
? `import {${placeholder_name} as ${placeholder_name_abbr}} from './$placeholder';`
: ''
}
export type CurriedFunction0<R> = () => R;
`).members,
...create_curried_interfaces(max_curry_level, selectable, placeholder).map(
the_interface => ({
...the_interface,
Expand Down

0 comments on commit 90af411

Please sign in to comment.