smooth-code / smooth-ui

Modern React UI library šŸ’…šŸ‘©ā€šŸŽ¤šŸ­
MIT License
1.59k stars 101 forks source link

@smooth-ui/core-em + TypeScript: TS2307: Cannot find module 'styled-components'. #106

Closed elliottsj closed 5 years ago

elliottsj commented 5 years ago

šŸ› Bug Report

Hello, thanks for developing Smooth UI! šŸ‘‹

I am getting started using emotion + @smooth-ui/core-em + TypeScript, and I'm encountering this error:

ERROR in /path/to/node_modules/@smooth-ui/core-em/dist/index.d.ts(4,35):
TS2307: Cannot find module 'styled-components'.

To Reproduce

Steps to reproduce the behavior:

npm install @smooth-ui/core-em @emotion/core @emotion/styled emotion-theming typescript @types/react
echo "import { Button } from '@smooth-ui/core-em';" > index.ts
./node_modules/.bin/tsc index.ts

Output:

node_modules/@smooth-ui/core-em/dist/index.d.ts:4:35 - error TS2307: Cannot find module 'styled-components'.

4 import * as styledComponents from 'styled-components'
                                    ~~~~~~~~~~~~~~~~~~~

Found 1 error.

Expected behavior

No TypeScript error raised.

Link to repl or repo (highly encouraged)

(I hope the three repro steps above are enough. I can create a repo if needed.)

Run npx envinfo --system --binaries --npmPackages @smooth-ui/core-sc,@smooth-ui/core-em,styled-components,@emotion/core,@emotion/styled,emotion-theming --markdown --clipboard

Paste the results here:

npx: installed 1 in 1.82s

*** Clipboard option removed - use clipboardy or clipboard-cli directly ***

## System:
 - OS: macOS 10.14.2
 - CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
 - Memory: 714.46 MB / 16.00 GB
 - Shell: 2.7.1 - /usr/local/bin/fish
## Binaries:
 - Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
 - Yarn: 1.12.3 - /usr/local/bin/yarn
 - npm: 6.6.0 - ~/.nvm/versions/node/v10.13.0/bin/npm
## npmPackages:
 - @emotion/core: ^10.0.6 => 10.0.6
 - @emotion/styled: ^10.0.6 => 10.0.6
 - @smooth-ui/core-em: ^8.1.0 => 8.1.0
 - emotion-theming: ^10.0.6 => 10.0.6
gregberge commented 5 years ago

Hello @elliottsj, thanks for the issue. It is a TypeScript issue, I can't fix it on my own. Help is welcome here!