TypeScript Definitions Missing
See original GitHub issueCurrently I can’t compile my typescript react project when trying to use the new styled-components/primitives
library extension because typings definitions are not present for the react-primitives
repository. There is also no @types/react-primitives
present either.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:8 (1 by maintainers)
Top Results From Across the Web
How to include missing type definition files in typescript ...
I would suggest switching to types from typeRoots and using an include pattern rather than files . { "compilerOptions": { "lib": ["dom" ...
Read more >How to Declare Missing Types for External Libraries -- newline
Custom Types Declaration#. First, in your tsconfig.json add a directory path to type declarations:.
Read more >Typescript: missing type definitions. · Issue #8642 - GitHub
I am opening this issue to report missing types when I notice that. Here is the first: Cookie options type does not have...
Read more >Missing type definition (typescript) - Handsontable Forum
Hi, We have upgraded to the latest version (11.1.0) and are experiencing missing type definitions for the samplingRatio and ...
Read more >How to add missing types to a library. : r/typescript - Reddit
I'm having trouble adding types to a library. The specific library itself is Shippo's node client. It comes with type definitions however ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As @mathieudutour suggested, you can import the types from
@types/react-native
.I got it working by making a
src/@types/react-primitives/index.d.ts
file with the following contents:There will be one more step if you’re using React Primitives in a Webpack build. Webpack and React Native both declare global, incompatible type definitions for
require
.So you’ll have add the following to your
tsconfig.json
to just avoid type-checkingnode_modules
(which is faster anyways):Hopefully that helps!
I would normally make a PR to this repo or DefinitelyTyped to just add these, but I’m not familiar enough with React Native and Primitives to know if it’s truly a one-to-one types match. Can someone more in-the-know help with that?
Someone posted a similar code from above on
DefinitelyTyped
so you can do this now:yarn add --dev @types/react-primitives
.