use-context-selector icon indicating copy to clipboard operation
use-context-selector copied to clipboard

`createContext` return type is `any`

Open heyitsarpit opened this issue 3 years ago • 3 comments

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 avatar Mar 04 '22 15:03 heyitsarpit

Interesting...

I wonder if this as any does anything wired. https://github.com/dai-shi/use-context-selector/blob/9e5174ea4ca2725c9177e5c672e1dcd880186ede/src/index.ts#L110

Happy to see anyone has any suggestions.

dai-shi avatar Mar 05 '22 01:03 dai-shi

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

vitorgouveia avatar Apr 11 '22 21:04 vitorgouveia

@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.

heyitsarpit avatar Apr 11 '22 21:04 heyitsarpit

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?

orta avatar Apr 25 '23 20:04 orta

@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.

heyitsarpit avatar Apr 29 '23 09:04 heyitsarpit