-
Notifications
You must be signed in to change notification settings - Fork 266
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
chore(parse-duration): convert to TypeScript #7981
base: master
Are you sure you want to change the base?
Conversation
a49acff
to
a01466e
Compare
a01466e
to
1d36d80
Compare
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.
Rebase on top of master, the code has changed because I merged your other PR.
@@ -2,11 +2,11 @@ | |||
|
|||
const ms = require('ms') | |||
|
|||
exports.parseDuration = value => { | |||
exports.parseDuration = (value: number | string): number => { |
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.
parseDuration
will throw for other types, should we accept them in the types or not?
I don't know the best practice for this.
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 should only accept types that can be used by the function (and avoid "any").
If at runtime we should have data of an unintended type, this is handled by error handling.
"rootDir": "./src" | ||
}, | ||
"exclude": ["node_modules", "dist"] | ||
} |
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 don't like this config, too many settings, and too many I don't understand.
What do you think of delegating the tedious configuration to the community?
Something like: https://github.com/julien-f/untitled/blob/dba7b3404da054f906a0f017daede66f7378e281/tsconfig.json
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 need to keep control over this file. More than just a configuration, it is what allows us to define the quality of code we want.
3f08791
to
9301b10
Compare
CI failed because of eslint. I had to put TS options in it back. |
9301b10
to
7551783
Compare
Changes after code review
7551783
to
410ba97
Compare
Description
Convert parseDuration to TS
XO-162
Checklist
Fixes #007
,See xoa-support#42
,See https://...
)Introduced by
CHANGELOG.unreleased.md