Skip to content

Conversation

@brettz9
Copy link
Collaborator

@brettz9 brettz9 commented Oct 23, 2025

fix(imports-as-dependencies): check within exports for types; fixes #1114

@brettz9 brettz9 added the bug label Oct 23, 2025
@brettz9 brettz9 merged commit 6c13a32 into gajus:main Oct 23, 2025
5 checks passed
@github-actions
Copy link

🎉 This PR is included in version 61.1.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@brettz9 brettz9 deleted the refactor branch October 23, 2025 16:38
if (!pkg || (!pkg.types && !pkg.typings)) {
if (!pkg || (!pkg.types && !pkg.typings && !resolve.exports(pkg, '.', {
conditions: [
'!default', '!import', '!node', 'types',
Copy link

Choose a reason for hiding this comment

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

Hi, I was following the !default discussions where you posted recently but I'm not up to date with this project so my comment may not apply.

I just wanted to let you know that by excluding with !import, due to the way that resolve.exports (and your fork) works, you may be missing some types conditions defined either inside an imports object (eg, https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html#packagejson-exports-imports-and-self-referencing or https://www.typescriptlang.org/docs/handbook/modules/reference.html#example-explicit-types-condition) or as a types object (eg, https://app.unpkg.com/ts-api-utils@2.1.0/files/package.json#L17).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for this. Not sure about imports, but for the types object, it seems we would need to add support for hierarchical conditions to resolve.exports.

This rule also misses types defined as globals or based solely on file path.

I think we need separate issues to track these things. Do you care to file one?

Copy link
Collaborator Author

@brettz9 brettz9 Oct 28, 2025

Choose a reason for hiding this comment

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

I've submitted a new feature which only checks for types, but also respects nesting. Thanks again for the report!

Copy link

Choose a reason for hiding this comment

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

Thank you for adding the types utility to your fork!

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

2 participants