Skip to content

Commit

Permalink
fix(react-storage): fix createStorageBrowser type issue (#6217)
Browse files Browse the repository at this point in the history
Co-authored-by: Allan Zheng <[email protected]>
  • Loading branch information
ashwinkumar6 and AllanZhengYP authored Nov 29, 2024
1 parent 9ab56f4 commit c59b2e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
CreateStorageBrowserOutput,
StorageBrowserProviderProps,
StorageBrowserType,
DerivedCustomViews,
DerivedActionViewType,
} from './types';
import {
Expand Down Expand Up @@ -125,10 +124,10 @@ export function createStorageBrowser<
);
}

const StorageBrowser: StorageBrowserType<
DerivedActionViewType<RInput>,
DerivedCustomViews<RInput>
> = ({ views, displayText }) => (
const StorageBrowser: StorageBrowserType<RInput> = ({
views,
displayText,
}) => (
<ErrorBoundary>
<Provider displayText={displayText} views={views}>
<StorageBrowserDefault />
Expand Down
17 changes: 9 additions & 8 deletions packages/react-storage/src/components/StorageBrowser/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,19 @@ export interface StorageBrowserProviderProps<V = {}>
views?: V;
}

export interface StorageBrowserType<K = string, V = {}> {
(props: StorageBrowserProps<K, V>): React.JSX.Element;
export interface StorageBrowserType<C extends ExtendedActionConfigs> {
(
props: StorageBrowserProps<DerivedActionViewType<C>, DerivedCustomViews<C>>
): React.JSX.Element;
displayName: string;
Provider: (props: StorageBrowserProviderProps<V>) => React.JSX.Element;
Provider: (
props: StorageBrowserProviderProps<DerivedCustomViews<C>>
) => React.JSX.Element;
CopyView: CopyViewType;
CreateFolderView: CreateFolderViewType;
DeleteView: DeleteViewType;
UploadView: UploadViewType;
LocationActionView: LocationActionViewType<K>;
LocationActionView: LocationActionViewType<DerivedActionViewType<C>>;
LocationDetailView: LocationDetailViewType;
LocationsView: LocationsViewType;
}
Expand Down Expand Up @@ -97,10 +101,7 @@ export type DerivedActionViewType<T extends StorageBrowserActions> =
export interface CreateStorageBrowserOutput<
C extends ExtendedActionConfigs = ExtendedActionConfigs,
> {
StorageBrowser: StorageBrowserType<
DerivedActionViewType<C>,
DerivedCustomViews<C>
>;
StorageBrowser: StorageBrowserType<C>;
useAction: UseAction<DerivedActionHandlers<C>>;
useView: UseView;
}

0 comments on commit c59b2e2

Please sign in to comment.