Skip to content

Commit ca17e4a

Browse files
Copilotanupriya13
andcommitted
Fix TypeScript compilation errors by removing unused helper methods
Co-authored-by: anupriya13 <54227869+anupriya13@users.noreply.github.com>
1 parent 9c79810 commit ca17e4a

3 files changed

Lines changed: 392 additions & 416 deletions

File tree

packages/@react-native-windows/cli/src/commands/moduleWindowsSetup/moduleWindowsSetup.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,31 +1402,7 @@ ${defaultImplementations}
14021402
return typeMap[tsType] || 'React::JSValue';
14031403
}
14041404

1405-
private mapTSReturnTypeToCpp(tsReturnType: string): string {
1406-
if (tsReturnType.includes('Promise')) {
1407-
return 'void'; // Promise methods return void and use callback
1408-
}
1409-
return this.mapTSToCppType(tsReturnType);
1410-
}
14111405

1412-
private extractPromiseType(promiseType: string): string {
1413-
const match = promiseType.match(/Promise<(.+)>/);
1414-
return match ? match[1] : 'any';
1415-
}
1416-
1417-
private generateExampleReturn(returnType: string): string {
1418-
if (returnType === 'string') {
1419-
return 'promise.Resolve("example");';
1420-
} else if (returnType === 'number') {
1421-
return 'promise.Resolve(42);';
1422-
} else if (returnType === 'boolean') {
1423-
return 'promise.Resolve(true);';
1424-
} else if (returnType === 'void') {
1425-
return 'promise.Resolve();';
1426-
} else {
1427-
return 'promise.Resolve(React::JSValue{});';
1428-
}
1429-
}
14301406

14311407
private generateDefaultValue(returnType: string): string {
14321408
if (returnType === 'string') {

vnext/codegen/rnwcoreJSI-generated.cpp

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -958,41 +958,6 @@ NativeAnimatedTurboModuleCxxSpecJSI::NativeAnimatedTurboModuleCxxSpecJSI(std::sh
958958
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleCxxSpecJSI_removeListeners};
959959
methodMap_["queueAndExecuteBatchedOperations"] = MethodMetadata {1, __hostFunction_NativeAnimatedTurboModuleCxxSpecJSI_queueAndExecuteBatchedOperations};
960960
}
961-
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_getColorScheme(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
962-
auto result = static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->getColorScheme(
963-
rt
964-
);
965-
return result ? jsi::Value(std::move(*result)) : jsi::Value::null();
966-
}
967-
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_setColorScheme(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
968-
static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->setColorScheme(
969-
rt,
970-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
971-
);
972-
return jsi::Value::undefined();
973-
}
974-
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
975-
static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->addListener(
976-
rt,
977-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
978-
);
979-
return jsi::Value::undefined();
980-
}
981-
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
982-
static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->removeListeners(
983-
rt,
984-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
985-
);
986-
return jsi::Value::undefined();
987-
}
988-
989-
NativeAppearanceCxxSpecJSI::NativeAppearanceCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
990-
: TurboModule("Appearance", jsInvoker) {
991-
methodMap_["getColorScheme"] = MethodMetadata {0, __hostFunction_NativeAppearanceCxxSpecJSI_getColorScheme};
992-
methodMap_["setColorScheme"] = MethodMetadata {1, __hostFunction_NativeAppearanceCxxSpecJSI_setColorScheme};
993-
methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeAppearanceCxxSpecJSI_addListener};
994-
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAppearanceCxxSpecJSI_removeListeners};
995-
}
996961
static jsi::Value __hostFunction_NativeAppStateCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
997962
return static_cast<NativeAppStateCxxSpecJSI *>(&turboModule)->getConstants(
998963
rt
@@ -1038,6 +1003,41 @@ NativeAppThemeCxxSpecJSI::NativeAppThemeCxxSpecJSI(std::shared_ptr<CallInvoker>
10381003
: TurboModule("AppTheme", jsInvoker) {
10391004
methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeAppThemeCxxSpecJSI_getConstants};
10401005
}
1006+
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_getColorScheme(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1007+
auto result = static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->getColorScheme(
1008+
rt
1009+
);
1010+
return result ? jsi::Value(std::move(*result)) : jsi::Value::null();
1011+
}
1012+
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_setColorScheme(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1013+
static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->setColorScheme(
1014+
rt,
1015+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
1016+
);
1017+
return jsi::Value::undefined();
1018+
}
1019+
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1020+
static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->addListener(
1021+
rt,
1022+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
1023+
);
1024+
return jsi::Value::undefined();
1025+
}
1026+
static jsi::Value __hostFunction_NativeAppearanceCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1027+
static_cast<NativeAppearanceCxxSpecJSI *>(&turboModule)->removeListeners(
1028+
rt,
1029+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
1030+
);
1031+
return jsi::Value::undefined();
1032+
}
1033+
1034+
NativeAppearanceCxxSpecJSI::NativeAppearanceCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
1035+
: TurboModule("Appearance", jsInvoker) {
1036+
methodMap_["getColorScheme"] = MethodMetadata {0, __hostFunction_NativeAppearanceCxxSpecJSI_getColorScheme};
1037+
methodMap_["setColorScheme"] = MethodMetadata {1, __hostFunction_NativeAppearanceCxxSpecJSI_setColorScheme};
1038+
methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeAppearanceCxxSpecJSI_addListener};
1039+
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeAppearanceCxxSpecJSI_removeListeners};
1040+
}
10411041
static jsi::Value __hostFunction_NativeBlobModuleCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
10421042
return static_cast<NativeBlobModuleCxxSpecJSI *>(&turboModule)->getConstants(
10431043
rt
@@ -1141,27 +1141,6 @@ NativeClipboardCxxSpecJSI::NativeClipboardCxxSpecJSI(std::shared_ptr<CallInvoker
11411141
methodMap_["getString"] = MethodMetadata {0, __hostFunction_NativeClipboardCxxSpecJSI_getString};
11421142
methodMap_["setString"] = MethodMetadata {1, __hostFunction_NativeClipboardCxxSpecJSI_setString};
11431143
}
1144-
static jsi::Value __hostFunction_NativeDeviceEventManagerCxxSpecJSI_invokeDefaultBackPressHandler(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1145-
static_cast<NativeDeviceEventManagerCxxSpecJSI *>(&turboModule)->invokeDefaultBackPressHandler(
1146-
rt
1147-
);
1148-
return jsi::Value::undefined();
1149-
}
1150-
1151-
NativeDeviceEventManagerCxxSpecJSI::NativeDeviceEventManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
1152-
: TurboModule("DeviceEventManager", jsInvoker) {
1153-
methodMap_["invokeDefaultBackPressHandler"] = MethodMetadata {0, __hostFunction_NativeDeviceEventManagerCxxSpecJSI_invokeDefaultBackPressHandler};
1154-
}
1155-
static jsi::Value __hostFunction_NativeDeviceInfoCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1156-
return static_cast<NativeDeviceInfoCxxSpecJSI *>(&turboModule)->getConstants(
1157-
rt
1158-
);
1159-
}
1160-
1161-
NativeDeviceInfoCxxSpecJSI::NativeDeviceInfoCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
1162-
: TurboModule("DeviceInfo", jsInvoker) {
1163-
methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeDeviceInfoCxxSpecJSI_getConstants};
1164-
}
11651144
static jsi::Value __hostFunction_NativeDevLoadingViewCxxSpecJSI_showMessage(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
11661145
static_cast<NativeDevLoadingViewCxxSpecJSI *>(&turboModule)->showMessage(
11671146
rt,
@@ -1271,6 +1250,27 @@ NativeDevSettingsCxxSpecJSI::NativeDevSettingsCxxSpecJSI(std::shared_ptr<CallInv
12711250
methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeDevSettingsCxxSpecJSI_removeListeners};
12721251
methodMap_["setIsShakeToShowDevMenuEnabled"] = MethodMetadata {1, __hostFunction_NativeDevSettingsCxxSpecJSI_setIsShakeToShowDevMenuEnabled};
12731252
}
1253+
static jsi::Value __hostFunction_NativeDeviceEventManagerCxxSpecJSI_invokeDefaultBackPressHandler(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1254+
static_cast<NativeDeviceEventManagerCxxSpecJSI *>(&turboModule)->invokeDefaultBackPressHandler(
1255+
rt
1256+
);
1257+
return jsi::Value::undefined();
1258+
}
1259+
1260+
NativeDeviceEventManagerCxxSpecJSI::NativeDeviceEventManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
1261+
: TurboModule("DeviceEventManager", jsInvoker) {
1262+
methodMap_["invokeDefaultBackPressHandler"] = MethodMetadata {0, __hostFunction_NativeDeviceEventManagerCxxSpecJSI_invokeDefaultBackPressHandler};
1263+
}
1264+
static jsi::Value __hostFunction_NativeDeviceInfoCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
1265+
return static_cast<NativeDeviceInfoCxxSpecJSI *>(&turboModule)->getConstants(
1266+
rt
1267+
);
1268+
}
1269+
1270+
NativeDeviceInfoCxxSpecJSI::NativeDeviceInfoCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
1271+
: TurboModule("DeviceInfo", jsInvoker) {
1272+
methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeDeviceInfoCxxSpecJSI_getConstants};
1273+
}
12741274
static jsi::Value __hostFunction_NativeDialogManagerAndroidCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
12751275
return static_cast<NativeDialogManagerAndroidCxxSpecJSI *>(&turboModule)->getConstants(
12761276
rt

0 commit comments

Comments
 (0)