-
Notifications
You must be signed in to change notification settings - Fork 41
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
Error after updating to 1.1.0 #22
Comments
Oh weird. Let me look into this and get back to you |
Experiencing the same issue |
Experiencing the same issue also. |
Same here, any fix for this? |
I'm not able to reproduce this. Node 9 / Hapijs 17. @Vija02 @serranoarevalo any chance you can provide a bit more info about your environments? |
I'm not using this library anymore. However, when i tried to recreate the error, I got this instead: Reproduction:
index.ts import * as apolloResolvers from 'apollo-resolvers'
export const baseResolver = apolloResolvers.createResolver(
null,
(root, args, context, error) => error,
)
|
@Vija02 thanks for that. I poked around and it looks like the es6 shim types are required to make the PromiseConstructor visible.
It may be something we want to add as a dependency. |
Hi,
The error in my IDE is createResolver does not exist on type...... |
Just to confirm, using node 8.9.1. Typescript 2.8.1 |
@appsolutegeek what does your tsconfig.json look like? Do you have your types and typeRoots configured? |
OK it appears that this error is caused when the necessary built in type declarations are not provided to tsc. They should to be explicitly linked either in the tsconfig.json or by passing the --lib flag to tsc. Like so:
or configuring your lib and target in your tsconfig.json "compilerOptions": {
"target": "es5",
"lib": ["es6"],
...
} Closing this unless there are further questions. |
@mringer The problem is that resolver.d.ts return a export declare const createResolver: (resFn: any, errFn: any) => (root: any, args?: {}, context?: {}, info?: {}) => Promise<any>; Maybe adding concrete types could solve this issue for ts users. |
@mringer Can this be reopened? From what I can tell, it's impossible to use this library when a TS project is using strict mode. While I don't see how the |
The lib compiler option matters because it informs tsc on which shims and type definitions it should include when it builds. If the shim containing the promise definitions isn't included in your build, your build will fail. Did you use the command line flag? I saw some variance between various tsconfig.json options, but passing the flag to the tsc cli always built correctly. @corydeppen if you have a build config that better accommodates end users feel free to submit a PR. |
I believe I understand the purpose of the compiler option, but it doesn't seem relevant to the original issue, which I continue to see even with the @mringer Do you have an example using this library in strict mode? |
@corydeppen minimum compilable repo here Using There may be an issue with extending Resolver which is itself a Function not an Object. But this specific error stack appeared to stem from TSC not being able to resolve |
@thebigredgeek @corydeppen I proposed the pull request #33 10 days ago to add concrete types. TSC inferring is limited because libraries are expected to manually export the right custom @mringer I'm not sure leaving users configuration define types exports interpretation is the way to go... |
On building with typescript, this error message is presented
error TS2339: Property 'createResolver' does not exist on type '(root: any, args?: {}, context?: {}) => Promise<any>'.
Is there anything that needs to be updated?
I've reverted to 1.0.3 for now
The text was updated successfully, but these errors were encountered: