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
Add initial types for fgraphql #469
Add initial types for fgraphql #469
Conversation
Thanks for the effort. We do need typings for fgraphql. https://medium.com/@eddyystop/fgraphql-feathers-graphql-hook-38faee75dd1 Unfortunately the tests are not passing. Setting APT mirror in /etc/apt/sources.list: http://us-east-1.ec2.archive.ubuntu.com/ubuntu/
|
@eddystop I've gotta update the package lock.json. I'll do that in a few hours. |
@eddyystop Should be fixed now. Took a few tries though lol. I don't know why vscode wasn't catching these things. Is it because there isn't a tslint.json? |
@j2L4e please confirm this follows the standards the rest of typings follow. |
[i: string]: (parent: any, args: any, content: any, ast: any) => any; | ||
}; | ||
Query: { | ||
[i: string]: (parent: any, args: any, content: any, ast: any) => any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these any
s could be stricter, but I can imagine that it may be hard to get right. Just thinking. Tightening these later would most likely be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parent, args, content, ast will always be objects. I guess its possible some custom code may make context,ast undefined or perhaps null.
@NickBolles thanks for adding the tests and fixing the linting errors. dtslint is pretty strict and can be a pain sometimes. |
@jsl4e do we want to do anything about "Parent, args, content, ast will always be objects. I guess its possible some custom code may make context,ast undefined or perhaps null."? Or should I merge? |
Sounds like |
Should I merge? |
I missed this conversation before. I think we should make the two changes that j2l4e suggested. I can do those quick later tonight I think. I haven't used fgraphql at all since doing this PR, so this hasn't really been in my mind. Sorry about the delay! |
That'd be great, go ahead: ) |
@NickBolles
|
@j2L4e @eddyystop Why is there an async version and a non-async version? As far as I can tell they are actually the same implementation, one just explicitly returns a promise, while the other is an async function which also returns a promise, just via async/await. |
@NickBolles sync/async version of what? I'll be back tomorrow morning |
We will remove fgraphql-async because batchloader can only work with promises. I had to rewrite the original async back into promises. 🤥 |
Gotcha, that makes sense! |
I'm losing track of outstanding TS issues. Is this one resolved? I'm asking because I have to write the next article on populate hooks but don't want to do that if there are issues with it in TS. |
Looks done to me |
Summary
Add initial version of types for fgraphql. This was erroring (for some reason, not quite sure why though) in my project, which was generated by feathers+ cli. So I thought I'd get these started.
TS for keep fgraphql #467
Other Information
There are a few enhancements that we could do still, to query, runtime, parse function return and possibly resolvers (a generic type for ResolverMap)
Docs issue #466
question: Why is there an async version and a non-async version. As far as I can tell they are actually the same implementation, with different keywords