-
-
Notifications
You must be signed in to change notification settings - Fork 50.5k
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
setFieldsValue bug with union type of Array and null #43305
setFieldsValue bug with union type of Array and null #43305
Comments
Try to reproduce by forking https://codesandbox.io/s/quizzical-carson-z4kjnl and change typescript version in package.json |
Hello @AndreiTS. Please provide a online reproduction by forking codesandbox of [email protected] or [email protected], or provide a minimal GitHub repository. Issues labeled by 你好 @AndreiTS, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击这里创建一个 [email protected] 或 [email protected] 的 codesandbox,或者提供一个最小化的 GitHub 仓库。3 天内未跟进此 issue 将会被自动关闭。 |
@afc163 here is a minimal reproduction: https://github.com/AndreiTS/antd-setFieldsValue-typescript this problem occurs because of this RecursivePartial implementation: |
@kiner-tang changing any to T is better but don't fix the original issue: typescript playground |
That's because strictNullChecks is turned on by default, so you can turn it off and try again. |
Could you support this option? It's turned on by default, and enabled is TypeScript is on strict mode |
If you want to keep this option on, wouldn't it be better not to use 'null' in the type definition? You can use other types instead. This is due to strictNullChecks in Typescript, not our RecursivePartial tool |
Yes, I can. I actually replaced all null by undefined in my project where it was complaining, but it is annoying and it's probably going to affect someone else. I think there are other RecursivePartial implementations that could help with this. |
Given the issue shown in the example above, I would like to reopen this issue and request a resolution |
Reproduction link
I cannot reproduce this on codesanbox, probably because it's using a different typescript version, so I'm using
TypeScript playground
Steps to reproduce
Open TypeScript playground link and check the error.
What is expected?
Is expected that setFieldsValue supports properties of type Array | null
What is actually happening?
setFielsValue errors on properties of type Array | null
The text was updated successfully, but these errors were encountered: