Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings for individual ES modules #2674

Closed
osdiab opened this issue Oct 21, 2018 · 3 comments
Closed

Typings for individual ES modules #2674

osdiab opened this issue Oct 21, 2018 · 3 comments

Comments

@osdiab
Copy link

osdiab commented Oct 21, 2018

Given #2355 , I looked into importing the functions directly, but unfortunately there are only TypeScript typings for importing the "ramda" module directly rather than specific modules like "ramda/es/pick" or "ramda/es/isNil". For my own project I'm just writing quick wrappers like so:

declare module "ramda/es/pick" {
  import * as R from "ramda";
  const pick: typeof R.pick;
  export default pick;
}

But presumably we should be able to just autogenerate all of these in DefinitelyTyped. If I get the time to work on it I'll take a look at doing that but until then if someone else wants to do it feel free.

@osdiab
Copy link
Author

osdiab commented Oct 21, 2018

Ah, I updated my create-react-app to 2.0, so it now uses webpack 4, and the bundle size looks much smaller. Given that, I probably won't prioritize this anymore, but if someone else has that problem then maybe you can make this happen.

@foxbunny
Copy link
Contributor

foxbunny commented Oct 21, 2018

@osdiab I use the babel-plugin-ramda and it works wonders in my ES6 project. Not sure about the TypeScript but I see no reason why it wouldn't work.

EDIT: This means that (if you don't already) you have to use both TS and Babel to compile your code, but it's not a big change, iirc.

@osdiab
Copy link
Author

osdiab commented Oct 21, 2018

Yeah, like I mentioned, webpack@4 also works wonders. Glad that babel-plugin-ramda also works for you. Just, for those who don't have the nice tree shaking tools but do use TypeScript, it would be nice to have typings per file. But like I mentioned, no longer essential to me since webpack@4 seems to do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants