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.

refs is missing in declaration file

See original GitHub issue

I 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:open
  • Created 5 years ago
  • Reactions:17
  • Comments:27 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
resynth1943commented, Jan 14, 2021

@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.

image

5reactions
pierre-Hcommented, Aug 11, 2021

Same problem. Any news ?

Read more comments on GitHub >

github_iconTop 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 >

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