Skip to content

Conversation

@nvsd
Copy link

@nvsd nvsd commented Dec 11, 2025

Updated the 'default' field to include types which avoids import issues such as the below error:

Could not find a declaration file for module '@lob/lob-typescript-sdk'. implicitly has an 'any' type.
There are types at 'f/node_modules/@lob/lob-typescript-sdk/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@lob/lob-typescript-sdk' library may need to update its package.json or typings.


Note

Update package.json to make exports.default an object that includes import and types so TypeScript declarations are resolved.

Written by Cursor Bugbot for commit 22586ae. This will update automatically on new commits. Configure here.

Updated the 'default' field to include types which avoids import issues such as the below error:

Could not find a declaration file for module '@lob/lob-typescript-sdk'. <package> implicitly has an 'any' type.
  There are types at 'f/node_modules/@lob/lob-typescript-sdk/dist/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@lob/lob-typescript-sdk' library may need to update its package.json or typings.
@nvsd nvsd requested a review from a team as a code owner December 11, 2025 08:52
@gemini-code-assist
Copy link

Summary of Changes

Hello @nvsd, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the package's module resolution configuration by adjusting the package.json exports field. The change specifically targets the default export condition, ensuring that TypeScript can correctly locate and utilize type declaration files. This enhancement prevents common import errors where modules are implicitly typed as any due to unresolved type definitions, thereby improving the developer experience and type safety for consumers of this package.

Highlights

  • TypeScript Type Resolution: Updated the 'default' field in 'package.json' to explicitly include 'types', resolving issues where TypeScript could not find declaration files when respecting package.json 'exports'.
  • Package Export Configuration: Modified the 'package.json' 'exports' map to ensure proper type declaration linking for the default export, transitioning from a direct path to an object with 'import' and 'types' conditions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a TypeScript type resolution issue by updating the default field in the exports map of package.json. The change adds an explicit types entry, which ensures that TypeScript can locate the declaration files when the package is imported as an ES module. This is the standard and correct way to resolve the described import error. I have added one suggestion to make the package's exports more robust for CommonJS environments.

Comment on lines +54 to +57
"default": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}

Choose a reason for hiding this comment

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

medium

While this change correctly adds type definitions for the default export, the default condition is missing an entry for require. This could cause issues for CommonJS-based tools that respect exports but don't match the node condition. To make the package more robust, I suggest adding the require path.

With this change, the default condition would become identical to the node condition. As a follow-up, you could consider simplifying the exports map by removing the now-redundant node condition and just keeping the comprehensive default one.

    "default": {
      "import": "./dist/index.mjs",
      "require": "./dist/index.cjs.js",
      "types": "./dist/index.d.ts"
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant