Skip to content

Commit 377d2de

Browse files
fix: inline FlashListProps to remove @shopify/flash-list type dependency (#2620)(by @YevheniiKotyrlo)
The published BottomSheetFlashList.d.ts unconditionally imports from @shopify/flash-list, but flash-list is not declared in any dependency field. Consumers who don't install flash-list get TS2307 because TypeScript strips @ts-ignore from emitted .d.ts files (by design, confirmed in TypeScript #38628). Replace the external type import with a minimal local interface extending FlatListProps<T> from react-native. The runtime try/catch require('@shopify/flash-list') is unchanged -- only types are affected. Fixes #2390
1 parent 0a0a060 commit 377d2de

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/components/bottomSheetScrollable/BottomSheetFlashList.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
// @ts-expect-error
2-
import type { FlashListProps } from '@shopify/flash-list';
31
import React, { forwardRef, memo, type Ref, useMemo } from 'react';
4-
import type { ScrollViewProps } from 'react-native';
2+
import type { FlatListProps, ScrollViewProps } from 'react-native';
53
import type { AnimatedProps } from 'react-native-reanimated';
64
import BottomSheetScrollView from './BottomSheetScrollView';
75
import type {
86
BottomSheetScrollableProps,
97
BottomSheetScrollViewMethods,
108
} from './types';
119

10+
/**
11+
* Minimal subset of FlashListProps needed for BottomSheetFlashList.
12+
* Defined locally to avoid requiring @shopify/flash-list as a dependency,
13+
* since the runtime import is optional (try/catch require).
14+
*/
15+
interface FlashListProps<T> extends FlatListProps<T> {
16+
estimatedItemSize?: number;
17+
}
18+
1219
let FlashList: {
1320
FlashList: React.FC;
1421
};

0 commit comments

Comments
 (0)