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

Have package.json point to correct type file #89

Merged
merged 3 commits into from
Jun 24, 2024

Conversation

aarsilv
Copy link
Contributor

@aarsilv aarsilv commented Jun 24, 2024

Eppo Internal:
🎟️ *Ticket: FF-2505 - Could not find a declaration file for module
🗨️ *Slack: "...signals about the declaration file being missing..."

Motivation and Context

Typescript allows including type information with an npm package using the types (or typings) field in package.json. (docs)

However, our entry for this field pointed to a non-existent file, which would result in typescript-loader generate the following warning error:

[tsl] ERROR in /Users/aaron/Workspace/webpack-demo/src/index.ts(2,38)
      TS2307: Cannot find module '@eppo/js-client-sdk' or its corresponding type declarations.

Description

To fix this, we point our type file at the correct top-level type file, index.d.ts.
To better follow convention, we've also renamed the typings field to types.

How has this been tested?

Installing the updated and rebuilt package in a simple test application no-longer has the error.

image

@@ -8,7 +8,7 @@
"/src",
"!*.spec.ts"
],
"typings": "dist/js-client-sdk.d.ts",
"types": "dist/index.d.ts",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index.d.ts is what is generated for our top-level index.ts

image

Copy link
Member

@felipecsl felipecsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great find! LGTM

@aarsilv aarsilv assigned aarsilv and unassigned greghuels Jun 24, 2024
@aarsilv aarsilv merged commit 86e205c into main Jun 24, 2024
2 checks passed
@aarsilv aarsilv deleted the aaron/ff-2505/fix-typing-file branch June 24, 2024 18:54
@greghuels
Copy link
Collaborator

🎉

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

Successfully merging this pull request may close these issues.

3 participants