Skip to content
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

createContext return type is any #71

Closed
heyitsarpit opened this issue Mar 4, 2022 · 5 comments
Closed

createContext return type is any #71

heyitsarpit opened this issue Mar 4, 2022 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@heyitsarpit
Copy link

So this doesn't seem to be an issue with the library(maybe), but the returned type for createContext is any when I hover over it VSCode, but if I try writing something with it, the autocomplete correctly completes the fields.

Looking at the type definition in the node_modules, and it looks correct to me.

Screenshot 2022-03-04 at 9 17 27 PM

Screenshot 2022-03-04 at 9 17 47 PM

The weirdest thing is if I hover over Context.Provider, it shows the correct type.

@heyitsarpit heyitsarpit changed the title createContext return type is any createContext return type is any Mar 4, 2022
@dai-shi
Copy link
Owner

dai-shi commented Mar 5, 2022

Interesting...

I wonder if this as any does anything wired.

delete (context as any).Consumer; // no support for Consumer

Happy to see anyone has any suggestions.

@dai-shi dai-shi added the help wanted Extra attention is needed label Mar 5, 2022
@vitorgouveia
Copy link

@heyitsarpit are you using typescript or just the vscode intellisense?
just to be sure

@heyitsarpit
Copy link
Author

@heyitsarpit are you using typescript or just the vscode intellisense?
just to be sure

The codebase is typescript, the screenshot I posted are vscode's on hover type inspection.

@orta
Copy link

orta commented Apr 25, 2023

This might be a bug in TypeScript (from the code path which shows the hover information), can you make a repro that works in the TypeScript playground?

@heyitsarpit
Copy link
Author

@orta The issue is a year old and I just checked and don't observer this behaviour anymore. Things working as expected. I guess we can close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants