Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sverrejoh opened this issue Sep 12, 2023 · 1 comment
Open

Comments

@sverrejoh
Copy link
Member

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.

@sverrejoh
Copy link
Member Author

Pr for fixing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant