Skip to content

It references "react" in the public typing declarations but doesn't add a dependency for "@types/react" #1359

Closed
@slavafomin

Description

@slavafomin

Hello!

Thank you for this great plugin!

However, in published index.d.ts file you are referencing the react package in some exports of yours. However, you don't specify the dependency for @types/react, which causes issues in projects where TypeScript compiler is running in "strict" mode and where dependencies are installed by a more strict package manager like pnpm (Rush).

It gives the following TypeScript error during application compilation:

ERROR in ~/app/common/temp/node_modules/.registry.npmjs.org/react-hot-loader/[email protected][email protected]/node_modules/react-hot-loader/index.d.ts(1,24):

TS7016: Could not find a declaration file for module 'react'.
'~/app/common/temp/node_modules/.registry.npmjs.org/react/16.10.2/node_modules/react/index.js' implicitly has an 'any' type.
If the 'react' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react`

As you have react in your peer dependencies, you should also add @types/react there as well in order for TypeScript projects to be able to resolve typing declarations correctly.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions