jacob-ebey / styled-components-ts

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress and the added benefits of TypeScript 💅
Do What The F*ck You Want To Public License
150 stars 5 forks source link

Fixed error TS4023 which would occur during use #4

Closed fanyang89 closed 6 years ago

fanyang89 commented 6 years ago

Deps: "typescript": "^2.7.1"

Example:

import * as React from "react";
import styled from "styled-components";
import themed from "styled-components-ts";

export interface IProps{}

const Foo = themed<IProps>(styled.div)`
  /* some styles */
`;

export default Foo;

Error message:

[ts] Exported variable 'Foo' has or is using name 'StyledComponentClass' from external module "e:/Workspace/xxxx/node_modules/styled-components-ts/node_modules/styled-components/typings/styled-components" but cannot be named.

After applying this PR, you can modify example code like this to avoid [TS4023].(https://github.com/Microsoft/TypeScript/issues/5711)

import * as React from "react";
import styled from "styled-components";
import themed, { StyledComponentClass } from "styled-components-ts";

export interface IProps{}

const Foo = themed<IProps>(styled.div)`
  /* some styles */
`;

export default Foo;
jacob-ebey commented 6 years ago

I added this update just now when adding in CI for this project. Thanks for catching this and let me know if it's still an issue.

You can open a new issue (or a new PR) if the issue persists.