-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Dependencies between library definitions? #16
Comments
I think flow needs a setting for the env (node/browser) Everything else should be modular. So the current react defs in flow should be in here. |
On libdef dependencies:I hadn't really thought about this, but it makes sense. So to just start by circling the simplest solution: How about a dependencies.json {
"react": "~14.0.0"
} On importing things within a
|
I'm more a fan of the opt-in version instead of opt-out. |
I also like the opt-in version better.
Especially in the case of For the importing part: What are the next steps for this issue? Is there anything already in the pipeline? |
Seems we've already encountered a need for this: #44 |
I've made type definitions for the Kefir, and then I've made type definitions for other libraries that return values of type Being able to use an import statement inside of
|
Hi all, has there been any movement on this issue? I'm happy to contribute in whatever way I can. I'm new to flow, and whilst I find it awesome, I have been taken aback by the lack of type definitions. I immediately forked this repo in the hope of contributing a It would be great to get this issue moving along as the more typed we make the world will make flow that much more appealing. :) |
Actually, AFAIK @jeffmo is pushing the feature for importing declarations in other so if you e.g use |
Indeed, this is on my near-term plate. I'm currently preoccupied with the 0.28 release (which is pretty complicated as it contains fixes for unions, but at the expense of some trade-offs that we're still working through). As a result my bandwidth is pretty low right now, but hopefully in the next couple of weeks I can hop back on the horse and keep driving here. |
Hello. I am not sure if I understand this. I want to write definitions from module Is there a way do that correctly? Should I copy-paste |
@jeffmo sorry, no pressure here, but just wanting to know if there was any update on this issue? |
To respond on Jeff's behalf, he said he's planning on coming back to flow-typed to bring it to feature completeness soon. We are discussing workflows around flow-typed and |
@jeffmo Have you started work on this yet? I have some time I can contribute, and we could use this feature. |
@CrabDude: I haven't started yet so I'd love to just let you run with it. Before that we should probably nail down a design and consider its various touch-points, though. Reviewing this thread, it seems like my suggestion to have a An alternative proposal might be to have a special declare module "MyModule" {
declare import _ from "lodash" @ "4.15.x";
} Any thoughts on this alternative idea? |
I'm needing this right now. Also, support for non-npm packages. We have types for Atom and Electron in Nuclide that we want to use in other packages. There are several issues with this:
So the highlights are:
|
I believe what makes sense to have is an ability to specify the version of the dependency you are importing types from |
Is there a tracking issue for platform/env config? Separating dom.js from WebWorkers would be useful. |
@calebmer hello!
// flow-typed signature: 319db8c4ec38ff5487d595965e709ea7
// flow-typed version: <<STUB>>/@most/create_v^2.0.1/flow_v0.63.1
declare module '@most/create' {
import type { Stream } from 'most'; // not found
declare function create<A>(
f: (
add: (a: A) => void,
end: (x?: A) => void,
error: (e: Error) => void
) => void
): Stream<A>;
} Is there any way to solve it? |
I'm actually having an issue trying to do this. I'm basically trying to use a type from Here is what I have: /**
* @flow
*/
declare module "koa-router" {
import type { Middleware } from "koa";
// ...Use `Middleware` in definitions...
} When I try to run my libdef test (currently only running for v0.64), here is the output I get:
|
Any progress? |
I'm kind of confused by this ticket. Are the current flow-type definitions that import types from other installed libraries not actually importing/applying them? |
Any imports in the current libs are getting assigned an import type { Middleware, $Request, $Response } from "express"; In that line, |
@samwgoldman I don't know why the discussion started out primarily about React, that's only the tip of the iceberg. This is a serious, wide-ranging issue. For instance, it's currently impossible to guarantee that a bonafide graphql |
This is certainly a major issue with being able to successfully use flow. Currently it's possible to import and reuse types from other libdefs (extending an imported class is a seperate issue though..). Importing types from a library with existing types however, is impossible, and instead flow reports the module as not found. The workaround for myself at the moment is to duplicate the types of the library in a libdef, which allows the types to be imported in other libdefs. The issue I have atm with this, is that as @jedwards1211 points out, the types detected by flow conflict and are not compatible. For some reason specifically for the All of this is just work around though, and feels wrong. It also certainly not ideal to have to duplicate types that should just work. |
We would love for this conversation to be actively discussed in the Flow repo, since we actually have nothing to do with the problem. It is a serious problem, but we have no control over it. |
@AndrewSouthpaw can you provide a link to this issue in the Flow repo, please? I haven't found something similar there. |
I'm unaware of one. If one doesn't exist, start it. :) |
I've commented on this one here: facebook/flow#3883 |
I started writing this out in the facebook/flow repo, but I think it actually might belong here. At least I think the discussion is more appropriate here, and might lead to tasks for Flow.
In a world where flow-typed manages library definitions for things like React, how should people write definitions for their libraries that depend on React types? Currently we allow library definitions to export global types, but I'm only interested in modular proposals.
I think it's worth separating libraries, like React, from environments, like node or browsers. It's possible that the same thing might solve both cases, but maybe not.
Library definitions currently describe compatibility with version(s) of the library itself and version(s) of Flow, but what about dependencies to other library definitions? What about node libraries vs. dom libraries?
The text was updated successfully, but these errors were encountered: