Codegen refuses Record<string, T> in a TypeScript TurboModule spec: Unrecognized generic type 'Record'
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 70/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, react-native, typescript
- Área
- build-system, mobile
Línea de trabajo
Start with packages/react-native-codegen/src/parsers/typescript/modules/index.js, especially translateTypeReferenceAnnotation and the existing emitDictionary path; then inspect the common type table in parsers-primitives.js. Compare the schemas for Record<string, T>, Readonly<Record<string, T>>, index signatures, and CodegenTypes.UnsafeObject; done means both Record spellings produce the index-signature schema while the existing forms keep theirs.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
@react-native/codegen's TypeScript parser refuses Record<string, T> in a NativeModule spec, and Readonly<Record<string, T>> the same way, with Unrecognized generic type 'Record' in NativeModule spec., while it reads {[key: string]: T}, the type Record<string, T> names, as a dictionary of T.
On main (de7e643aa3) the refusal is the default branch of translateTypeReferenceAnnotation, since emitCommonTypes' table has no Record; a type literal with an index signature goes to emitDictionary.
Expected: Record<string, T> and Readonly<Record<string, T>> parse as {[key: string]: T} does, to a GenericObjectTypeAnnotation whose dictionaryValueType is T, and {[key: string]: T} and CodegenTypes.UnsafeObject keep the schema they get today.
Steps to reproduce
- Clone the reproducer below.
ReproducerApp/specs/NativeSample.tsis a TurboModule spec with one method,setOptions(options: Record<string, unknown>): void. - Run its
repro.shin anode:24container:
It installsdocker run --rm -v "$PWD:/repro:ro" node:24 bash /repro/repro.shreact-native@nightlyand parses the spec with@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js, the script Android'sgenerateCodegenSchemaFromJavaScripttask runs, beside copies of the spec whose parameter isReadonly<Record<string, unknown>>,{[key: string]: unknown}andCodegenTypes.UnsafeObject. - Expected: both
Recordspellings parse to the schema{[key: string]: unknown}gets. Actual: codegen refuses both:Record<string, unknown> -> UnsupportedGenericParserError: Module NativeSample: Unrecognized generic type 'Record' in NativeModule spec. Readonly<Record<string, unknown>> -> UnsupportedGenericParserError: Module NativeSample: Unrecognized generic type 'Record' in NativeModule spec.bash /repro/repro.sh 0.88.1shows the same on the latest stable.
React Native Version
0.88.1
Affected Platforms
Build - Linux
Areas
TurboModule - The New Native Module System, Codegen
Output of npx @react-native-community/cli info
System:
OS: Linux 6.18 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
CPU: (24) x64 AMD Ryzen 9 9950X3D 16-Core Processor
Memory: 120.26 GB / 125.63 GB
Shell:
version: 5.2.15
path: /bin/bash
Binaries:
Node:
version: 24.22.2
path: /usr/local/bin/node
Yarn:
version: 1.22.22
path: /usr/local/bin/yarn
npm:
version: 11.19.1
path: /usr/local/bin/npm
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native:
installed: 0.90.0-nightly-20261112-897cca827
wanted: ^0.90.0-nightly-20261112-897cca827
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
== install react-native@nightly
react-native 0.90.0-nightly-20261112-897cca827 with @react-native/codegen 0.90.0-nightly-20261112-897cca827
== parse each spelling of the parameter with node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js
Record<string, unknown> -> UnsupportedGenericParserError: Module NativeSample: Unrecognized generic type 'Record' in NativeModule spec.
Readonly<Record<string, unknown>> -> UnsupportedGenericParserError: Module NativeSample: Unrecognized generic type 'Record' in NativeModule spec.
{[key: string]: unknown} -> {"type":"GenericObjectTypeAnnotation","dictionaryValueType":{"type":"GenericObjectTypeAnnotation"}}
CodegenTypes.UnsafeObject -> {"type":"GenericObjectTypeAnnotation"}
SUMMARY: react-native 0.90.0-nightly-20261112-897cca827's codegen does not read Record<string, unknown> as it reads {[key: string]: unknown}
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/react-native-codegen-record-in-module-spec
Screenshots and Videos
No response
- Lenguaje dominante
- C++
- Estrellas
- 127k
- Forks
- 25.5k
- Merge medio
- 3 d 22 h
- PR fusionados (30 d)
- 235
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de react/react-native
-
Needs: Author Feedback Needs: Repro
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
react/react-native#60059 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Needs: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
react/react-native#60000 ·
Los mantenedores suelen responder en 2 días
-
`yarn test-ios` exits before building RNTester: `objc-test.sh` launches the WebSocket server script #59433 deletedPosiblemente ocupada @lazerg la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
react/react-native#59939 ·
Los mantenedores suelen responder en 2 días
-
iOS Fabric pointer-handler reset leaves the next lone touch non-primaryPosiblemente ocupada @alleneubank la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
react/react-native#59919 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
react/react-native#59722 ·
Los mantenedores suelen responder en 2 días
Todos los issues de react/react-native
Issues similares
-
[fuzzer-found][mlir][tosa] `TransposeOp::reifyResultShapes` crashes on unranked tensor inputAbiertocrash generated by fuzzer mlir
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
llvm/llvm-project#243218 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
petercorke/robotics-toolbox-python#943 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
realtime
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
NVIDIA/cuda-quantum#5913 ·
Los mantenedores suelen responder en 1 día
-
[hidapi] update to 0.16.0Abiertocategory:port-update
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
area:build bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
NatronGitHub/openfx-arena#71 ·
Los mantenedores suelen responder en 1 día