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

feat: add type definition #68

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: add type definition #68

wants to merge 3 commits into from

Conversation

adenvt
Copy link

@adenvt adenvt commented Sep 20, 2024

Add type definition for typescript user

@romainmenke
Copy link
Member

Hi @adenvt,

Thank you for your contribution 🎉

Personally I don't find it is maintainable to have a manual .d.ts file.
I think that this places the highest burden on maintainers and provides the least value/assurances.

So I don't think we can accept this even if I appreciate your effort.


However I would consider a change that adds JSDoc type annotations.

Benefits of JSDOc annotations:

  • can be tested
  • helps maintainers to write better code
  • .d.ts files can be generated from them

Stylelint for example uses such a setup : https://github.com/stylelint/stylelint

@adenvt
Copy link
Author

adenvt commented Sep 30, 2024

@romainmenke Thank for reviewing.

I'm update it, and follow your approach to use JSDoc and generate .d.ts from it. I did:

  • Add script npm run build-types to generate .d.ts
  • Update lib/index.js to has more strict type.
  • Update script/clean.js to remove types/* before build
  • Update .gitignore

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.

2 participants