Skip to content

Packages missing types conditional in package.json exports field. #351

@sverrejoh

Description

@sverrejoh

The packages here has main, types, module and exports field. The exports field can contain the information from the other fields.

When using TyperScript with the moduleResolution: "bundler" setting, TypeScript will verify that all imports has an entry in the exports map, if the export map exists, and this includes the types entry.

In this repo the exports field doesn't add the types conditional, and errors with the following message:

packages/nova-dev-app-providers/src/DevAppProvider.tsx:5:26 - error TS7016: Could not find a declaration file for module '@graphitation/apollo-react-relay-duct-tape'. 'node_modules/@graphitation/apollo-react-relay-duct-tape/lib/index.mjs' implicitly has an 'any' type.
  There are types at 'node_modules/@graphitation/apollo-react-relay-duct-tape/lib/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@graphitation/apollo-react-relay-duct-tape' library may need to update its package.json or typings.

5 import * as graphQL from "@graphitation/apollo-react-relay-duct-tape";
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1 error

The fix would be to add the types conditional for each entry in the exports map.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions