Skip to content

Commit

Permalink
Update React Native codegen to support Partial as alias of $Partial
Browse files Browse the repository at this point in the history
Summary:
`Partial` is the new name of `$Partial`

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D43993220

fbshipit-source-id: 38e8a6bcfa559857b2ab88efee6b904b387bdc0d
  • Loading branch information
gkz authored and facebook-github-bot committed Mar 15, 2023
1 parent 06b97ca commit 7fee407
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export type SomeObj = {|
b?: boolean,
|};

export type PartialSomeObj = $Partial<SomeObj>;
export type PartialSomeObj = Partial<SomeObj>;

export interface Spec extends TurboModule {
+getSomeObj: () => SomeObj;
+getPartialSomeObj: () => $Partial<SomeObj>;
+getSomeObjFromPartialSomeObj: (value: $Partial<SomeObj>) => SomeObj;
+getPartialSomeObj: () => Partial<SomeObj>;
+getSomeObjFromPartialSomeObj: (value: Partial<SomeObj>) => SomeObj;
+getPartialPartial: (
value1: $Partial<SomeObj>,
value1: Partial<SomeObj>,
value2: PartialSomeObj,
) => SomeObj;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ export type SomeObj = {|
export interface Spec extends TurboModule {
+getSomeObj: () => SomeObj;
+getPartialSomeObj: () => $Partial<SomeObj>;
+getSomeObjFromPartialSomeObj: (value: $Partial<SomeObj>) => SomeObj;
+getPartialSomeObj: () => Partial<SomeObj>;
+getSomeObjFromPartialSomeObj: (value: Partial<SomeObj>) => SomeObj;
}
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
Expand Down Expand Up @@ -340,10 +340,10 @@ export type SomeObj = {|
b?: boolean,
|};
export type PartialSomeObj = $Partial<SomeObj>;
export type PartialSomeObj = Partial<SomeObj>;
export interface Spec extends TurboModule {
+getPartialPartial: (value1: $Partial<SomeObj>, value2: PartialSomeObj) => SomeObj
+getPartialPartial: (value1: Partial<SomeObj>, value2: PartialSomeObj) => SomeObj
}
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function translateTypeAnnotation(
case 'Object': {
return emitGenericObject(nullable);
}
case 'Partial':
case '$Partial': {
throwIfPartialWithMoreParameter(typeAnnotation);

Expand Down

0 comments on commit 7fee407

Please sign in to comment.