question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v4.0.0] Types: Could not find a declaration file for module 'styled-components/native'.

See original GitHub issue

there are no types for react-native components

Environment

npx: Installierte 1 in 2.983s

System:

  • OS: macOS High Sierra 10.13.6
  • CPU: x64 Intel® Core™ i5-6267U CPU @ 2.90GHz
  • Memory: 751.21 MB / 16.00 GB
  • Shell: 5.3 - /bin/zsh

Binaries:

  • Node: 10.9.0 - /usr/local/bin/node
  • Yarn: 1.10.1 - /usr/local/bin/yarn
  • npm: 5.10.0 - /usr/local/bin/npm
  • Watchman: 4.9.0 - /usr/local/bin/watchman

Reproduction

add typescript and tslint

Steps to reproduce

let tslint your code

Expected Behavior

no error

Actual Behavior

$ tslint --project tsconfig.json && yarn typecheck
$ tsc --noEmit
App.tsx(5,20): error TS7016: Could not find a declaration file for module 'styled-components/native'. '…/app/node_modules/styled-components/native/dist/styled-components.native.cjs.js' implicitly has an 'any' type.
bildschirmfoto 2018-10-15 um 22 37 11 bildschirmfoto 2018-10-15 um 22 38 01

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:19
  • Comments:41 (3 by maintainers)

github_iconTop GitHub Comments

1038reactions
jaccaocommented, Dec 22, 2020

styled-components/native types moved to @types/styled-components-react-native.

281reactions
AndreCosta101commented, Jan 20, 2021

Just add:

❯yarn add @types/styled-components-react-native -D

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find a declaration file for module 'styled-components ...
If you try to do this in a React Native TypeScript project, you'll run into the following typings error: Could not find a...
Read more >
Could not find declaration file for 'styled-components'
The error "could not find declaration file for module 'styled-components'" occurs when TypeScript cannot find the type declaration for a ...
Read more >
types/styled-components - npm
Start using @types/styled-components in your project by running `npm i ... indicating that this package has built-in type declarations.
Read more >
could not find a declaration file of 'styled components" in nextjs
native.cjs.js' implicitly has an 'any' type. ... Could not find a declaration file for module 'react-beautiful-dnd'. '/Users/mohitharshan/Desktop/scramble/ ...
Read more >
Releases - styled-components
theme'; type ThemeType = typeof Theme; declare module 'styled-components' { export ... Update css-to-react-native to v3.0.0 (#2811); the one breaking change ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found