react-component / react-component/switch

SwitchProps interface is not exported

Open
#57 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
196
Forks
80
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing pull request #56 and the SwitchProps definition and export in lib/index. Done means the interface is publicly exported and the reported TypeScript ts(4023) error no longer occurs for the styled Switch example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.