Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ export type Getter<T> = () => T;

// This defines the types for the overrides object, whose methods can return
// null or undefined to fallback to the default value.
export type OverridesFor<T> = Partial<{
[key in keyof T]: Getter<?ReturnType<T[key]>>,
}>;
export type OverridesFor<T extends {readonly [string]: () => unknown}> =
Partial<{
[key in keyof T]: Getter<?ReturnType<T[key]>>,
}>;

function createGetter<T extends boolean | number | string>(
configName: string,
Expand Down
13 changes: 12 additions & 1 deletion scripts/js-api/build-types/resolution/simpleResolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
* @format
*/

const {PACKAGES_DIR} = require('../../../shared/consts');
const {
PACKAGES_DIR,
REACT_NATIVE_PACKAGE_DIR,
} = require('../../../shared/consts');
const {getPackages} = require('../../../shared/monorepoUtils');
const {existsSync} = require('node:fs');
const path = require('node:path');
Expand Down Expand Up @@ -38,6 +41,14 @@ async function simpleResolve(
});
}

// Resolve the 'react-native/react-private-interface' subpath export
if (importPath === 'react-native/react-private-interface') {
return path.join(
REACT_NATIVE_PACKAGE_DIR,
'src/react-private-interface.js',
);
}

// Resolve exact '@react-native/<package>' import
if (importPath in cachedProjectInfo) {
const packageJson = cachedProjectInfo[importPath].packageJson;
Expand Down
Loading