Ramda declarations, destructuring imports
See original GitHub issueTo grab the interface file I ran: flow-typed install ramda -f 0.26
, then added a line to my .flowconfig
to produce:
[libs]
decls
flow-typed/npm
I created a trivial test file…
/* @flow weak */
import { identity } from 'ramda'
console.log(identity(3))
And on type checking got…
handlers/scratch.js:3
3: import { identity } from 'ramda'
^^^^^^^^ Named import from module `ramda`. This module has no named export called `identity`.
Looking at the file, it appears that all of the declarations are exported building up one class through mixins, which class is then the sole export. This, it seems, produces the frustrating result above. I can work around this by avoiding destructuring import:
import Ramda from 'ramda'
const { map, add, identity } = Ramda
// map, add, identity now all typed
I’m new to flow, so it’s unclear to me whether this is an issue with the declarations in this repository, a result of some misunderstanding on my part, or a shortcoming of flow itself.
cc @alexeygolev @jeffmo. Thanks for your contributions so far.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (12 by maintainers)
Top Results From Across the Web
Is using an ES6 import to load specific names faster than ...
"There are definitely a few more ways." - actually, no. There's a default import syntax (which can be used in combination with either...
Read more >Ramda Documentation
Ramda. A practical functional library for JavaScript programmers. ... Destructuring imports from ramda does not necessarily prevent importing the entire ...
Read more >ramda
Destructuring imports from ramda does not necessarily prevent importing the entire library. You can manually cherry-pick methods like the ...
Read more >Ramda: Practical functional Javascript - Morioh
Destructuring imports from ramda does not necessarily prevent importing the entire library. You can manually cherry-pick methods like the following, ...
Read more >Lodash vs Ramda | What are the differences?
Ramda - A practical functional library for JavaScript programmers. ... where we can import the method names directly, without resorting to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just a quick update. Still working on it. Should be able to submit a PR before Monday. Found a couple of wrong typings along the way:-P
Support for both named and default exports inside a
declare module
will ship in 0.28 (no later than early next week). In the meantime,declare module
bodies can only export one or the other:Named via
declare module.exports: {namedExport1: number, namedExport2: string};
Default viadeclare module.exports: MyDefaultExportHere;
In 0.28 and beyond, it will be possible to do: