From 112c89e8105d1322dd1ebf072f9757c9d994e20b Mon Sep 17 00:00:00 2001 From: Vitali Zaidman Date: Mon, 30 Jan 2023 06:34:32 -0800 Subject: [PATCH] refactor: Renamed emitPartial to emitObject (#35982) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35982 This reflects better what the former `emitPartial` was doing - emitting an object with set props. Changelog: [Internal] - Renamed emitPartial to emitObject Reviewed By: christophpurrer Differential Revision: D42740958 fbshipit-source-id: 4f974c6911bc129e698323a8039bbd7aa7602461 --- .../src/parsers/__tests__/parsers-primitives-test.js | 8 ++++---- .../src/parsers/flow/modules/index.js | 4 ++-- .../src/parsers/parsers-primitives.js | 4 ++-- .../src/parsers/typescript/modules/index.js | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js b/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js index fd30944ea97f52..92f391d3bcb24f 100644 --- a/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js +++ b/packages/react-native-codegen/src/parsers/__tests__/parsers-primitives-test.js @@ -21,7 +21,7 @@ const { emitNumber, emitInt32, emitGenericObject, - emitPartial, + emitObject, emitPromise, emitRootTag, emitVoid, @@ -457,7 +457,7 @@ describe('emitGenericObject', () => { }); }); -describe('emitPartial', () => { +describe('emitObject', () => { describe('when nullable is true', () => { it('returns nullable type annotation', () => { const props = [ @@ -477,7 +477,7 @@ describe('emitPartial', () => { }, ]; - const result = emitPartial(true, props); + const result = emitObject(true, props); const expected = { type: 'NullableTypeAnnotation', @@ -509,7 +509,7 @@ describe('emitPartial', () => { }, ]; - const result = emitPartial(false, props); + const result = emitObject(false, props); const expected = { type: 'ObjectTypeAnnotation', diff --git a/packages/react-native-codegen/src/parsers/flow/modules/index.js b/packages/react-native-codegen/src/parsers/flow/modules/index.js index b8d2b22c5702ea..612d4c4ed2ccfe 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/index.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/index.js @@ -42,7 +42,7 @@ const { emitNumber, emitInt32, emitGenericObject, - emitPartial, + emitObject, emitPromise, emitRootTag, emitVoid, @@ -188,7 +188,7 @@ function translateTypeAnnotation( }; }); - return emitPartial(nullable, properties); + return emitObject(nullable, properties); } default: { return translateDefault( diff --git a/packages/react-native-codegen/src/parsers/parsers-primitives.js b/packages/react-native-codegen/src/parsers/parsers-primitives.js index a3ce61e7f494a9..23a7495b1654af 100644 --- a/packages/react-native-codegen/src/parsers/parsers-primitives.js +++ b/packages/react-native-codegen/src/parsers/parsers-primitives.js @@ -244,7 +244,7 @@ function emitGenericObject( }); } -function emitPartial( +function emitObject( nullable: boolean, properties: Array<$FlowFixMe>, ): Nullable { @@ -381,7 +381,7 @@ module.exports = { emitInt32, emitNumber, emitGenericObject, - emitPartial, + emitObject, emitPromise, emitRootTag, emitVoid, diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/index.js b/packages/react-native-codegen/src/parsers/typescript/modules/index.js index 98978beba95642..1d0a222b48d828 100644 --- a/packages/react-native-codegen/src/parsers/typescript/modules/index.js +++ b/packages/react-native-codegen/src/parsers/typescript/modules/index.js @@ -42,7 +42,7 @@ const { emitNumber, emitInt32, emitGenericObject, - emitPartial, + emitObject, emitPromise, emitRootTag, emitVoid, @@ -207,7 +207,7 @@ function translateTypeAnnotation( }, ); - return emitPartial(nullable, properties); + return emitObject(nullable, properties); } default: { return translateDefault(