Skip to content

Conversation

jwoo9928
Copy link

@jwoo9928 jwoo9928 commented Mar 4, 2025

Description

This pull request updates the package.json file by adding TypeScript type declarations to the "exports" field. Previously, TypeScript users faced issues due to missing type information, which caused errors during development. This change ensures proper type resolution for both Node.js and browser environments, improving the package’s usability for TypeScript developers.

Changes

  • Updated the "exports" field to include "types" entries:
    • For Node.js:
      • "require": { "types": "./dist/index-node.d.ts", "default": "./dist/index-node.cjs" }
      • "import": { "types": "./dist/index-node.d.ts", "default": "./dist/index-node.esm.js" }
    • For default (browser) environments:
      • "require": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
      • "import": { "types": "./dist/index.d.ts", "default": "./dist/index.esm.js" }
  • These changes align with the files in the dist directory (e.g., index-node.d.ts and index.d.ts), as shown in the project’s directory structure.

Why This Matters

TypeScript is widely used, and without proper type declarations, developers couldn’t fully utilize the package in typed projects. This fix eliminates those errors and enhances the developer experience.

Testing

  • I tested this in a sample TypeScript project using @aislamov/diffusers.js. The type errors are gone, and the package works correctly in both Node.js and browser setups.

Notes

  • This change should be backward-compatible and won’t affect non-TypeScript users.
  • Let me know if there’s anything else you’d like me to adjust!

Thanks for reviewing this contribution!

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.

1 participant