Restore .js fallback for legacy deep imports of untyped modules

Relocating the hand-written declarations under types_DEPRECATED/ (#57513)
changed where the react-native-legacy-deep-imports export condition points
for ./Libraries/*. It used to resolve to ./Libraries/*.d.ts, beside the real
.js, so TypeScript's extension substitution still found modules with no
hand-written declaration. It now resolves into types_DEPRECATED/, which
contains no .js files, so those specifiers stop resolving.

Reported against 0.88.0-rc.0 with react-native/Libraries/Core/InitializeCore.

Add the old location as a second entry so the condition falls back to it.
Modules that do have a declaration keep resolving to types_DEPRECATED/
because that entry is still first.

This is applied to 0.88-stable only. 0.88 is a non-breaking release, so the
regression must not ship in it. main intentionally keeps the current
behaviour pending a deliberate decision on retiring deep imports.
This commit is contained in:
Fabrizio Cucci committed 2026-09-16 13:36:44 +01:00
1 parent 74760de04c
commit 579212e15c
1 file changed
+4 -1
+4 -1
View File
@@ -34,7 +34,10 @@
"default": "./index.js"
},
"./Libraries/*": {
"react-native-legacy-deep-imports": "./types_DEPRECATED/Libraries/*.d.ts",
"react-native-legacy-deep-imports": [
"./types_DEPRECATED/Libraries/*.d.ts",
"./Libraries/*.d.ts"
],
"types": null,
"default": "./Libraries/*.js"
},