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.

Typescript definition

See original GitHub issue

I tried to add this lib to my Typescript project (with new the JSX transformation), but I get an error in all of my React code:

Could not find a declaration file for module ‘@welldone-software/why-did-you-render/jsx-runtime’

This is my wdyr.ts file:

/// <reference types="@welldone-software/why-did-you-render" />

import React from 'react';

if (process.env.NODE_ENV === 'development') {
    const whyDidYouRender = require('@welldone-software/why-did-you-render');
    whyDidYouRender(React, {
        trackAllPureComponents: true,
    });
}

What is the correct way to add the types?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vzaidmancommented, Aug 22, 2021

@vzaidman , I am still seeing a similar error to the OP (v6.2.0). The jsx-runtime.d.ts does appear in the distribution.

Do the additional ts files need to be referenced in the package.json ? ie.

"files": [
...
"jsx-dev-runtime.d.ts"
"jsx-runtime.d.ts"

You are totally right.

I’ve just released version 6.2.1 with the types added in “files”.

Thank you!

1reaction
vzaidmancommented, May 11, 2021

seems like there are no types for the transformation indeed. I’ll try adding them asap.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: JavaScript With Syntax For Types.
TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale. Try TypeScript Now. Online or...
Read more >
TypeScript - Wikipedia
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and...
Read more >
What is TypeScript? Definition, History, Features and Uses
TypeScript is a strongly typed Object-Oriented open source programming language that builds on JavaScript. It is developed and supported by ...
Read more >
TypeScript - Overview - Tutorialspoint
By definition, “TypeScript is JavaScript for application-scale development.” TypeScript is a strongly typed, object oriented, compiled language.
Read more >
Typescript Definition & Meaning - Merriam-Webster
The meaning of TYPESCRIPT is a typewritten manuscript; especially : one intended for use as printer's copy.
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