-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
How to satisfy Server.adapter()
with typeof Adapter
?
#3796
Comments
I think you may be importing Adapter from the wrong place, imported it improperly or it may be incorrectly declared wherever you are importing it from. The exact type errors you are getting would be helpful here along with a more complete snippet/repo I could use to reproduce this error. I figure this is the jist of what you are trying to accomplish except with your own custom Adapter class? The below throws no type issues on my end
|
@MickL I think you are right, the typings are not correct. The
|
Isn't the problem that the types are using e.g. If it change it to this:
|
@grubstarstar the adapter function does not take a Adapter instance, but a function that takes a namespace and returns an Adapter instance (there is one Adapter instance per namespace, created here), so I don't think this would work. I guess we should rather have something like |
IMO the existing adapters should have a return type. Then they would run in the same problem as I did or solve my question. Currently they dont have any return type thats why they throw no error: Also the docs are wrong. The function does not return a RedisAdapter, instead it returns a function that may create a RedisAdapter: |
This should be fixed by 891b187. Please reopen if needed. |
Describe the bug
I am not sure if this is just a question or the typings are not correct, but it seems impossible for me to satisfy the
Server.adapter()
function which is defined as:I tried:
Looking at socket.ioredis it just has no return type / returns any :/
The text was updated successfully, but these errors were encountered: