-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
No export for props interface #4024
Copy link
Copy link
Closed
Description
- Framework7 version: 6.3.17
- React.js version: 17.0.2
- Platform and Target: Chrome browser
There is a problem then trying to wrap framework7 react components in my own component and extend its props (types) - props interface in files like node_modules\framework7-react\components\toggle\toggle.d.ts has no export.
And so TypeScript shows this error:
Exported variable 'Toggle' has or is using name 'ToggleProps' from external module ".../node_modules/framework7-react/components/toggle/toggle" but cannot be named.ts(4023)
There is a way how to extract props types and use it for typing, but I need to do it with every component:
export type F7ToggleProps = React.ComponentProps<typeof ToggleBase>Why there is no export interface props and can it be added?
I've added pull request for this - #4023
Example:
import { Toggle } from "framework7-react";
export type F7ToggleProps = React.ComponentProps<typeof Toggle >;
export const MyToggle: React.FC<F7ToggleProps> = props => {
return (
<div>
<Toggle {...props} />
</div>
);
});With export props interface it will be possible to do like this:
import { Toggle } from "framework7-react";
import { ToggleProps } from "framework7-react/components/toggle";
export const MyToggle: React.FC<ToggleProps > = props => {
return (
<div>
<Toggle {...props} />
</div>
);
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels