Avoid static_pointer_cast in GenerateModuleH.js (#44889)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44889

Avoid static_pointer_cast. It provides no type-safety, and requires increasing the shared_ptr

## Changelog:

[Internal] [Fixed] - Avoid static_pointer_cast in GenerateModuleH.js

Reviewed By: javache

Differential Revision: D58449748

fbshipit-source-id: 4d46b4e18fc28758296a67271182a471a99b5d83
This commit is contained in:
Christoph Purrer 2024-06-12 10:14:48 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 20462ca984
Коммит c5d380fc98
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -568,9 +568,9 @@ function translateEventEmitterToCpp(
isArray ? `std::vector<${templateName}>` : templateName
}, ${jsiType}>, "value cannnot be converted to ${jsiType}");`
}
std::static_pointer_cast<AsyncEventEmitter<${
static_cast<AsyncEventEmitter<${
isVoidTypeAnnotation ? '' : 'jsi::Value'
}>>(delegate_.eventEmitterMap_["${eventEmitter.name}"])->emit(${
}>&>(*delegate_.eventEmitterMap_["${eventEmitter.name}"]).emit(${
isVoidTypeAnnotation
? ''
: `[jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {