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

fix: correct dts generation for stub mode #314

Merged
merged 7 commits into from
Jun 4, 2024
Merged

Conversation

xiaoxiangmoe
Copy link
Contributor

@xiaoxiangmoe xiaoxiangmoe commented Sep 14, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The document write:

/**
 * * `compatible` means "src/index.ts" will generate "dist/index.d.mts", "dist/index.d.cts" and "dist/index.d.ts".
 * * `node16` means "src/index.ts" will generate "dist/index.d.mts" and "dist/index.d.cts".
 * * `true` is equivalent to `compatible`.
 * * `false` will disable declaration generation.
 * * `undefined` will auto detect based on "package.json". If "package.json" has "types" field, it will be `"compatible"`, otherwise `false`.
 */

The behavior of the declaration option is inconsistent with the documentation.

  • If I write use 'node16', it will also convert to true.
  • If I write use false, it may convert to true if we have types or typing field in package.json. see declaration not workΒ #313 (This is a reasonable requirement since we may use other tools to package .d.ts. Just use unbuild to package .js)

So I create a bug fix for it.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pi0 pi0 changed the title fix: declaration option fix: correct declaration option Oct 30, 2023
@pi0 pi0 changed the title fix: correct declaration option fix: correct declaration option behavior Oct 30, 2023
@Miofly
Copy link

Miofly commented Nov 9, 2023

i encounter this problem

@pi0 pi0 changed the title fix: correct declaration option behavior fix: correct dts generation for stub mode Jun 4, 2024
@pi0
Copy link
Member

pi0 commented Jun 4, 2024

Thanks for PR dear @xiaoxiangmoe and sorry for late merge. I've rebased it together with #371 to land

@pi0 pi0 merged commit 44fa118 into unjs:main Jun 4, 2024
2 checks passed
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.

None yet

3 participants