Definitelytyped: ramda: no types found when using functions from es import

Created on 19 Feb 2018  Â·  10Comments  Â·  Source: DefinitelyTyped/DefinitelyTyped

If you know how to fix the issue, make a pull request instead.

  • [x] I tried using the @types/xxxx package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @donnut @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @charlespwd @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick

If you do not mention the authors the issue will be ignored.

How could we solve this?

I would love to be able to import sortBy from 'ramda/es/sortBy'; and have definitions

Maybe we could copy de index.d.ts file to an es folder, remove the declare namespace R line and then from the main index.d.ts import the es/index and re export all the functions from the R namespace. That way we have only one definition for function

thanks

Most helpful comment

I submitted this as an issue here: https://github.com/types/npm-ramda/issues/395
And it already got fixed and merged, and is available at types/npm-ramda#dist

All 10 comments

Actually we should create a file for each function definition in the es folder and then import each in the main index and re export them in the R static namespace

@mribichich consider trying the typings at types/npm-ramda. while not merged here yet, they should already support this.

great thanks! I'll take a look at it

On Mon, Apr 30, 2018 at 3:20 PM Tycho Grouwstra notifications@github.com
wrote:

@mribichich https://github.com/mribichich consider trying the typings
at types/npm-ramda https://github.com/types/npm-ramda/. while not
merged here yet, they should already support this.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/23765#issuecomment-385484756,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFe3SgYMW-O-Z_C1yzbtOPSm8FUH-xyhks5tt1X0gaJpZM4SK11d
.

I just tried types/npm-ramda. It looks like they support importing from the src folder using commonjs:

import sortBy = require('ramda/src/sortBy');

But they do NOT support importing from the es folder using ES6 modules. What would it take to implement the idea from @mribichich to create a file for each function in the es folder?

@battmanz would you mind filing this as an issue over there? I'm on phone now but think es modules may have been discussed there before.

I submitted this as an issue here: https://github.com/types/npm-ramda/issues/395
And it already got fixed and merged, and is available at types/npm-ramda#dist

I still get typescript errors for es import import filter from "ramda/src/filter"; Maybe i'm misunderstanding @rafaelcichocki last post, but has this not been fixed yet?
i'm using ramda & @types/ramda v0.26.1

@benjamingeorge you need to import from ramda/es/filter instead of ramda/src/filter to get the es imports. Only the es imports are typed currently, not the commonjs imports from ramda/src

great thank you.

Actually, this https://github.com/DefinitelyTyped/DefinitelyTyped/pull/33334 was just merged, so the ramda/src imports should also work with the latest typings

Was this page helpful?
0 / 5 - 0 ratings

Related issues

csharpner picture csharpner  Â·  3Comments

fasatrix picture fasatrix  Â·  3Comments

jbreckmckye picture jbreckmckye  Â·  3Comments

ArtemZag picture ArtemZag  Â·  3Comments

variousauthors picture variousauthors  Â·  3Comments