switch icon indicating copy to clipboard operation
switch copied to clipboard

SwitchProps interface is not exported

Open claudvanbarret opened this issue 5 years ago • 0 comments

I'm styling switch with styled-components in TypeScript like this:

import styled from "styled-components";
import Switch from "rc-switch";

export const StyledSwitch = styled(Switch)(({ checked, disabled }) => {
  position: "relative",
  borderRadius: "1rem",
  cursor: "pointer",
});

But I'm getting this error.

Exported variable 'StyledSwitch' has or is using name 'SwitchProps' from external module "/Users/claudvanbarret/project/node_modules/rc-switch/lib/index" but cannot be named.ts(4023)

This error can be probably is an issue in TypeScript, but wen can quickly solve this problem by exporting the SwitchProps interface.

I already send a pull request(https://github.com/react-component/switch/pull/56) to fix it.

claudvanbarret avatar Sep 03 '20 17:09 claudvanbarret