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

Modernize #52

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Modernize #52

wants to merge 9 commits into from

Conversation

OrbintSoft
Copy link

@OrbintSoft OrbintSoft commented Mar 11, 2023

I converted the project into typescript, updated dependencies and added esm module as output.

Copy link
Member

Choose a reason for hiding this comment

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

Remove this.

Copy link
Author

Choose a reason for hiding this comment

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

@OrbintSoft OrbintSoft requested a review from phated March 15, 2023 04:48
index.ts Outdated
Comment on lines 8 to 12
/**
* @typedef {(testString: string) => boolean} AnymatchFn
* @typedef {string|RegExp|AnymatchFn} AnymatchPattern
* @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher
*/
Copy link
Member

Choose a reason for hiding this comment

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

Shall we keep these jsdoc comments instead of turning this file into typescript? TS supports using jsdoc as typings so we don't need to convert to benefit from typing.

Copy link
Author

@OrbintSoft OrbintSoft Mar 15, 2023

Choose a reason for hiding this comment

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

jsdoc needs to be maintained, also index.d.ts that I removed. If you forget to update typings you risk issues like this: #40

Also typescript with noImplicitAny does a strict typing check assuring all types are correctly defined.

There are many other advantages of using typescript, like:

  • having multiple targets as output, supporting both commonjs and ecmascipt modules
  • using latest ecmascript features and targeting es5 keeping compatibility with nodejs versions.

Copy link
Member

Choose a reason for hiding this comment

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

I know the tradeoffs. I suppose I framed the reversion as a question, but I actually meant it as "this won't land without undoing the TS change".

Copy link
Author

Choose a reason for hiding this comment

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

Ah you mean you want keep the code in typescript, but use jsdoc instead of using declaring type.
Sure it can be done, but I don't see the advantage apart from reverting 3 lines change.
Typescript syntax is much more flexible and it has no much sense to keep jsodoc in a typescript project, anyway let me know what you prefer, if you want I'll revert it.

Copy link
Member

Choose a reason for hiding this comment

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

We subscribe to https://dev.to/thepassle/using-typescript-without-compilation-3ko4 - so please put the jsdoc typings back.

Copy link
Author

Choose a reason for hiding this comment

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

I read the article, personally I am totally against it, but anyway I don't want waste time discussing about. I hope one day they will standardize typings in ecmascript https://github.com/tc39/proposal-type-annotations.
For now I updated the code as you requested to use jsdoc instead of typescript, I hope you like it.

My goal was just to fix typings and make this library more maintainable with esm module support.

I did also some fixes to package.json to keep old nodeJs version compatibility and export correctly esm and cjs files.
Not sure anyway if still works with node 8, that's a pretty old node version.

@OrbintSoft OrbintSoft requested a review from phated May 18, 2023 16:54
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