-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Partial<Type> or $Partial<Type> are not supported in react-native-codegen #35864
Labels
Needs: Triage 🔍
Type: New Architecture
Issues and PRs related to new architecture (Fabric/Turbo Modules)
Comments
cortinico
added
the
Type: New Architecture
Issues and PRs related to new architecture (Fabric/Turbo Modules)
label
Jan 18, 2023
vzaidman
added a commit
to vzaidman/react-native
that referenced
this issue
Jan 25, 2023
Summary: Pull Request resolved: facebook#35961 Pull Request resolved: facebook#35960 This fixes facebook#35864 This feature allows using `$Partial<Obj>` in flow and `Partial<Obj>` in TypeScript based on the spec mentioned here: https://flow.org/en/docs/types/utilities/#toc-partial. We currently only allow passing an Obj to Partial so ``` export type SomeObj = { a: string, b?: boolean, }; export type PartialSomeObj = Partial<SomeObj>; ``` should work. and also- ``` export type PartialSomeObj = Partial<{ a: string, b?: boolean, }>; ``` But not ``` export type PartialSomeObj = Partial<Partial<{ a: string, b?: boolean, }>>; ``` This can be improved in the future by a recursive unwrapping of the value inside the `Partial` annotation. Changelog: [General] [Added] - Allow the use of "Partial<T>" in Turbo Module specs. Reviewed By: christophpurrer, cipolleschi Differential Revision: D42640880 fbshipit-source-id: 7f55e6cb2eec41f5e9d085b21b9ffd658b665140
vzaidman
added a commit
to vzaidman/react-native
that referenced
this issue
Jan 25, 2023
Summary: Pull Request resolved: facebook#35961 Pull Request resolved: facebook#35960 This fixes facebook#35864 This feature allows using `$Partial<Obj>` in flow and `Partial<Obj>` in TypeScript based on the spec mentioned here: https://flow.org/en/docs/types/utilities/#toc-partial. We currently only allow passing an Obj to Partial so ``` export type SomeObj = { a: string, b?: boolean, }; export type PartialSomeObj = Partial<SomeObj>; ``` should work. and also- ``` export type PartialSomeObj = Partial<{ a: string, b?: boolean, }>; ``` But not ``` export type PartialSomeObj = Partial<Partial<{ a: string, b?: boolean, }>>; ``` This can be improved in the future by a recursive unwrapping of the value inside the `Partial` annotation. Changelog: [General] [Added] - Allow the use of "Partial<T>" in Turbo Module specs. Reviewed By: christophpurrer, cipolleschi Differential Revision: D42640880 fbshipit-source-id: eba1ef64dd3a0c95d267a04f9e56cb8641ccbbf2
vzaidman
added a commit
to vzaidman/react-native
that referenced
this issue
Jan 26, 2023
Summary: Pull Request resolved: facebook#35961 Pull Request resolved: facebook#35960 This fixes facebook#35864 This feature allows using `$Partial<Obj>` in flow and `Partial<Obj>` in TypeScript based on the spec mentioned here: https://flow.org/en/docs/types/utilities/#toc-partial. We currently only allow passing an Obj to Partial so ``` export type SomeObj = { a: string, b?: boolean, }; export type PartialSomeObj = Partial<SomeObj>; ``` should work. and also- ``` export type PartialSomeObj = Partial<{ a: string, b?: boolean, }>; ``` But not ``` export type PartialSomeObj = Partial<Partial<{ a: string, b?: boolean, }>>; ``` This can be improved in the future by a recursive unwrapping of the value inside the `Partial` annotation. Changelog: [General] [Added] - Allow the use of "Partial<T>" in Turbo Module specs. Reviewed By: christophpurrer, cipolleschi Differential Revision: D42640880 fbshipit-source-id: e0b863c6863c312cc7b77438b326bfa5ed845d33
vzaidman
added a commit
to vzaidman/react-native
that referenced
this issue
Jan 26, 2023
Summary: Pull Request resolved: facebook#35961 Pull Request resolved: facebook#35960 This fixes facebook#35864 This feature allows using `$Partial<Obj>` in flow and `Partial<Obj>` in TypeScript based on the spec mentioned here: https://flow.org/en/docs/types/utilities/#toc-partial. We currently only allow passing an Obj to Partial so ``` export type SomeObj = { a: string, b?: boolean, }; export type PartialSomeObj = Partial<SomeObj>; ``` should work. and also- ``` export type PartialSomeObj = Partial<{ a: string, b?: boolean, }>; ``` But not ``` export type PartialSomeObj = Partial<Partial<{ a: string, b?: boolean, }>>; ``` This can be improved in the future by a recursive unwrapping of the value inside the `Partial` annotation. Changelog: [General] [Added] - Allow the use of "Partial<T>" in Turbo Module specs. Reviewed By: christophpurrer, cipolleschi Differential Revision: D42640880 fbshipit-source-id: 0caf8a600313d27efed83696359d0b3eca025303
OlimpiaZurek
pushed a commit
to OlimpiaZurek/react-native
that referenced
this issue
May 22, 2023
Summary: Pull Request resolved: facebook#35961 Pull Request resolved: facebook#35960 This fixes facebook#35864 This feature allows using `$Partial<Obj>` in flow and `Partial<Obj>` in TypeScript based on the spec mentioned here: https://flow.org/en/docs/types/utilities/#toc-partial. We currently only allow passing an Obj to Partial so ``` export type SomeObj = { a: string, b?: boolean, }; export type PartialSomeObj = Partial<SomeObj>; ``` should work. and also- ``` export type PartialSomeObj = Partial<{ a: string, b?: boolean, }>; ``` But not ``` export type PartialSomeObj = Partial<Partial<{ a: string, b?: boolean, }>>; ``` This can be improved in the future by a recursive unwrapping of the value inside the `Partial` annotation. Changelog: [General] [Added] - Allow the use of "Partial<T>" in Turbo Module specs. Reviewed By: christophpurrer, cipolleschi Differential Revision: D42640880 fbshipit-source-id: 03a3fccc38ccfc7a5440fe11893beb68e77753f3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Needs: Triage 🔍
Type: New Architecture
Issues and PRs related to new architecture (Fabric/Turbo Modules)
Description
I'm trying to use the codegen to generate a TurboModule with the following type:
But it fails with the error:
This is a great feature that's supported both in TS (https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) and flow (https://flow.org/en/docs/types/utilities/#toc-partial).
Without this feature, I'll have to rewrite the type as
I also tried defining
Partial
by myself:But this fails too with the error:
Version
latest
Output of
npx react-native info
n.a
Steps to reproduce
to any Turbo Module spec file
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: