-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Args is type any
in latest version (1.0.18)
#63
Comments
That's interesting. The types are good enough to warn about a mismatch if you add e.g. |
I'm not sure why TypeScript is distinguishing between a function passed as JSX child vs a |
Fixed in 63c6c8e. Will release in a bit. |
I still have the same problem with https://codesandbox.io/s/react-virtualized-auto-sizer-any-type-ny0l6l |
Maybe there's an issue with the TypeScript version being used on Code Sandbox. I'm not sure. TypeScript properly handles the types for the latest release, so I don't know what I can further do about this: |
I'm using the latest version of typescript in my editor (5.0.4) and I have the same issue there. |
@V-Mann-Nick could u prepare a repository that would showcase the problem? |
Yeah sure. Here it is: https://github.com/V-Mann-Nick/react-virtualized-auto-sizer-typing-bug
|
The problem is likely related to contextual types for Since this was a bug in TypeScript itself... I'm not sure if I can figure out a library-land fix for this but gonna take another look at this some time later today. On the flip side... this should start working in TS 5.1 which is supposed to get released... today 😅 (according to the timeline posted here) |
Thanks Andarist! |
Ok. I guess I'll just use the children prop for now and look at it again when TS 5.1 released. Perhaps worth reopening this issue until it has been resolved? Thanks for the quick responses 👍 |
@bvaughn I think that somehow you are using a different TS version locally, ain't sure how though. Could you recheck with cmd+P: "Select TypeScript Version..."? I tested this repro and can observe the problem as expected I tried a couple of things locally (different variations based on |
Seems like I'm using a pre-release TS version (5.2 dev from a few days ago). Don't know why. I'm sorry for the confusion this is causing folks, but I don't want to spend time reverting this change (the past couple of releases really) because of a TypeScript issue if it's being fixed/released today. This is a side side project for me. |
To be clear, there is no "fix" really. The previous types were inaccurate. (They didn't have this "any" type issue, but they did incorrect report height/width when one had been disabled.) I don't know of a good way type this that satisfies TypeScript, at least not without rewriting this component to be a function component (which may help but would also be a breaking change and raise the min React version). |
The issue is in the TS version. It's this issue, which exits in Typescript v4 and is fixed in v5: |
@shiftyp Interesting. Why is @V-Mann-Nick seeing this problem with TypeScript 5.0.4? |
Yes, I was mistaken about the fix. It's in the beta version 5.1, not in
5.0.4
…On Tue, May 30, 2023, 2:11 PM Brian Vaughn ***@***.***> wrote:
The issue is in the TS version. It's this issue, which exits in Typescript
v4 and is fixed in v5:
@shiftyp <https://github.com/shiftyp> Interesting. Why is @V-Mann-Nick
<https://github.com/V-Mann-Nick> seeing this problem with TypeScript
5.0.4?
—
Reply to this email directly, view it on GitHub
<#63 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABAGWESQ7CX2J5ZTZDNO7TXIYZ4BANCNFSM6AAAAAAYTAQX74>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I am using TS 5.1.3 and auto-sizer 1.0.20 and the problem stills happen. :( |
You will either need to upgrade Typescript to the latest (5.1) or pass children as a. Explicit prop rather than JSX children. I can’t help/fix this otherwise. |
Try this |
See codesandbox https://codesandbox.io/s/pedantic-violet-f0x5uf?file=/src/App.tsx
Edit: screenshot wasn't properly capturing the tooltip like I thought it was...so removed screenshot, but can hover over the height/width in the sandbox to see the type is
any
The text was updated successfully, but these errors were encountered: