React typings not found in 3rd party package with peerDependency
See original GitHub issueHello,
I am trying to get working library react-sortable-hoc
with preact
and browserify
in Typescript.
I tried to alias the react
package with aliasify
as described in preact-compat
package’s readme.
Unfortunately react-sortable-hoc
has peerDependency on react
and even when aliasing for .ts
files works fine I’ve encountered an error in typescript definition of the package (in .d.ts
file) :
TypeScript error: node_modules/react-sortable-hoc/types/index.d.ts(1,24): Error TS2307: Cannot find module 'react'.
I’ve been trying different approaches to solve this but none of them were successfull. So I would like to know if there is anything I can do to get that working? Also could preact-compat
somehow provide react typings that would solve the problems with preact + peer dependency in 3rd party react packages?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to publish a JS package that gracefully fails if an optional ...
In order for the new context provider to use the right react-dnd instance, I had to make it a peerDependencies entry and not...
Read more >Understanding Peer Dependencies in JavaScript
In this case, you would declare React as a peer dependency for your ... Notice how the package has no direct dependency, even...
Read more >ts-node - npm
TypeScript icon, indicating that this package has built-in type declarations ... Missing Types; npx, yarn dlx, and node_modules. Performance.
Read more >package.json | pnpm
If all projects in the monorepo use the same version of react , then no ... of the current package in the specified...
Read more >Build a component library with React and TypeScript
Resolving third-party dependencies in node_modules; Transpiling our TypeScript code to JavaScript; Preventing bundling of peerDependencies ...
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 Free
Top 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
Also think you might have to install
@types/react
Alias can be done via
pathmodify
plugin forbrowserify
see how to do that in this ticket.Thanks everyone for help.