Skip to content

TypeScript typings are not available due to wrong field in package.json #7149

@JReinhold

Description

@JReinhold

Hi.

Whenever I import something from this package in my TypeScript project, I get an error saying that the declarations could not be found:

error TS7016: Could not find a declaration file for module 'react-navigation-stack'.
'PROJECT_DIR/node_modules/react-navigation-stack/lib/commonjs/index.js' implicitly has an 'any' type.
  Try `npm install @types/react-navigation-stack` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-navigation-stack';`

3 import { StackViewStyleInterpolator } from 'react-navigation-stack';

I believe this is because the field that points at the index.d.ts file should be called types, but is called typescript here. If there is an actual reason that the field is called typescript here, please let me know!
Manually changing the field to types fixes the problem.

Workaround

Prepend all imports from react-navigation-stack with //@ts-ignore

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions