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

Add .d.ts #184

Open
bigbigDreamer opened this issue Sep 28, 2020 · 8 comments
Open

Add .d.ts #184

bigbigDreamer opened this issue Sep 28, 2020 · 8 comments

Comments

@bigbigDreamer
Copy link

Hi, mroderick:
I have an idea,
The popularity of typesript has become a trend, can I propose a PR to add index.d.ts to index.js to meet the current typescript requirements for strong type verification, instead of adding an additional @types library to do this .
And the current @types/pubsub-js is not fully considered, for example:

     declare var PubSub: PubSubJS.Base;

      declare module 'pubsub-js' {
         export = PubSub;
      }

Obviously, the use of the Node environment is not considered, but es6module is considered.
What do you think?

@mroderick
Copy link
Owner

I not against improving support for non-JS languages, but I am hesitant in taking on responsibility for maintaining something that I wouldn't use myself and only serves a subset of the userbase.

The approach I am working on in other projects is to describe the code with JSDoc comments. This allows modern editors and IDEs to display type hints and do auto completion. From the JSDoc I want to generate the .d.ts files automatically.

That way everyone benefits from the effort put into documenting the codebase, and those that use the compile time type checking in TypeScript can get the errors they need.

What do you think?

@bigbigDreamer
Copy link
Author

Wow, that will be great. Looking forward to your version upgrade, because there are more and more ts projects, we should be fully prepared for the warnings and errors that will be generated during the compilation phase. Feedback to newcomer developers or those who might ignore reading the API.
Thank you for your reply~

@lesichkovm
Copy link

Cannot easily use otherwise. Please reconsider @mroderick

TS2307: Cannot find module 'pubsub-js' or its corresponding type declarations.
  > 1 | import PubSub from 'pubsub-js'
``

@Lewiscowles1986
Copy link

Leaving this link here https://www.npmjs.com/package/@types/pubsub-js might not be perfect, but seems to exist, just via an external package.

@lesichkovm
Copy link

It looks like there is a pull request already created for this @mroderick

#216

@Lewiscowles1986
Copy link

Right but one is not needed, as an external third-party provides this.

a little more than 1/3rd of users using this (presumably) are using the @types/pubsub-js

Screenshot 2022-12-07 at 06 28 50

Versus the pubsub-js package stats

Screenshot 2022-12-07 at 06 29 14

I'm not against it, but it feels a bit like split efforts.

@Sinevia
Copy link

Sinevia commented Dec 7, 2022

@Lewiscowles1986 I do not really see your logic. Are you pushing users to use another library or package because it is better, and say this functionality should not be added to the current package because of this?

@Lewiscowles1986
Copy link

Hey @Sinevia I am not suggesting people do not use this package. I am suggesting that just like with multiple other JavaScript ecosystem projects, a separate @types package (which is not an alternative, but an additive); already exists.

I Personally would not add this to a legacy JS only package if I had to maintain it; but I think that is besides the point.

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

No branches or pull requests

5 participants