-
Notifications
You must be signed in to change notification settings - Fork 41
Modernize #52
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
base: master
Are you sure you want to change the base?
Modernize #52
Changes from 8 commits
0f402d5
6735a9d
f7ba94b
bf695c9
965cf77
91b9d38
7758f90
cb4cef1
2fdbca6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
.DS_Store | ||
npm-debug.log | ||
coverage | ||
.nyc_output |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const {anymatch} = require('./cjs') | ||
module.exports = anymatch |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import {anymatch} from './esm' | ||
export * from './esm' | ||
export default anymatch |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "ES6", | ||
"outDir": "./esm", | ||
}, | ||
"extends": "./tsconfig.json", | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"compilerOptions": { | ||
"alwaysStrict": true, | ||
"esModuleInterop": true, | ||
"module": "CommonJS", | ||
"moduleResolution": "node16", | ||
"noImplicitAny": true, | ||
"outDir": "./cjs", | ||
"preserveConstEnums": true, | ||
"removeComments": true, | ||
"sourceMap": true, | ||
}, | ||
"files": [ | ||
"index.ts", | ||
], | ||
} |
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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".
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.