facebook / facebook/flow

Get flow type information

Open
#7,250 0 comments 0 reactions 0 assignees View on GitHub
type information API
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I am currently experimenting with generating a GraphQL schema directly from code using flow types.

An example of the code would look like:

```js
function User(name) {
return {
name
}
}

function Query() {
return {
user: (args: { name: string }) => User(args.name)
}
}

```

which would generate the following GraphQL schema:

```graphql
type User {
name: string!
}

query {
user(name: string!): User!
}
```

To create the schema I need access to the types flow infers. As far as I know flow currently has 3 different commands to query information of the type-checker.

- `flow type-at-pos --expand-json-output and --expand-type-aliases` which has the problem that the source names are not included and also no way to check where a type was declared
- `flow ast` which has the problem that it doesn't include type information
- `flow dump-types` which doesn't include all the required data as well

Is there any way I current can query all the needed data to generate the schema?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.