-
Notifications
You must be signed in to change notification settings - Fork 91
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
Next server type issue(s) #30
Comments
This has been a reoccurring issue, and I am not entirely sure what the best way to fix it is. I have included next as a peerDependency, but it's not working as I expected it would. I'm not very well-versed in how peer deps work and would like to use the user's next-server rather than limiting it to the implementation of the next-server version that it was transpiled with. Maybe you could provide some insight? An easy work around would just for this lib to type the second arg of register as any, but this is a less than ideal solution IMO. register method: https://github.com/kyle-mccarthy/nest-next/blob/master/lib/render.module.ts#L23 |
I think the fact that next is also a required dependency may be the culprit. If the semver versions are incompatible, next-nest will get its own copy of Next, rathert than the main one. That said, "9.1.4" should be semver compatible to "^9.0.6", so I'm not sure why a separate copy is given... or maybe npm always does it, not just on mismatches... I use yarn, which definetly doesn't do that, but instead hoists compatible deps. Anyway, as a solution, change it to a devDependency I guess? |
@boenrobot Yup you are correct -- I had it is a peerDependency + dependency but it actually should be peerDependency + devDependency. I'll just pushed v9.1.1 with the correct package.json @ArrayKnight can you let me know if the new version resolves your issue? |
Sorry about the delayed response, I was on holiday. I can confirm that this has been fixed. Thank you |
Describe the bug
TS2345: Argument of type
'import(".../node_modules/next/dist/next-server/server/next-server").default'
is not assignable to parameter of type'import(".../node_modules/nest-next/node_modules/next/dist/next-server/server/next-server").default'
. Types have separate declarations of a private property 'compression'.For some reason Nest-Next implements a static version of Next (in a private node_modules) rather than using the installed peer. But that doesn't appear to be the root of the issue, since the two types actually have the same type definition for "compression":
private compression?;
Not sure what the core issue is...
Expected behavior
No type error.
To Reproduce
Version
The text was updated successfully, but these errors were encountered: