refs is missing in declaration file
See original GitHub issueI have noticed that having both preact and react types (@types/react) will confuse the typescript compiler and throw the following error:
‘Property ‘refs’ is missing in type ‘component’.’
apparently, the property ‘refs’ is missing from the ‘preact.d.ts’ declaration file.
adding the following code after line 101 in ‘preact.d.ts’ will solve the problem:
refs: { [key: string]: Component<any> | Element; };
tried to submit a PR, but couldn’t find the file mentioned.
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:17
- Comments:27 (6 by maintainers)
Top Results From Across the Web
refs is missing in declaration file #1206 - preactjs/preact - GitHub
'Property 'refs' is missing in type 'component'.' apparently, the property 'refs' is missing from the 'preact.d.ts' declaration file.
Read more >Could not find a declaration file for module 'module-name ...
In order for this to work, I had to make declare module '...' the first line of code in the module.d.ts file, and...
Read more >Documentation - Triple-Slash Directives - TypeScript
It serves as a declaration of dependency between files. Triple-slash references instruct the compiler to include additional files in the compilation process ...
Read more >Generation of TypeScript declaration files from JavaScript code
Discrepancies between a declaration file and the JavaScript implementation lead to incorrect feedback from the TypeScript IDE and, thus, to ...
Read more >cannot find module or its corresponding type declarations file
If it still doesn't work, I firstly recommend that you use a recent version of Typescript. if you do, then close your editor,...
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
@developit would you accept a fix for this? It’d be nice to hear… something from you, since this is affecting so many TypeScript users.
Here’s what you get when you ‘intermingle’ Preact-typed and React-typed components.
Same problem. Any news ?