-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(tsc): type check config files #5858
Conversation
@@ -19,6 +20,7 @@ module.exports = { | |||
audits: [ | |||
'byte-efficiency/unused-javascript', | |||
], | |||
// @ts-ignore TODO(bckenny): type extended Config where e.g. category.title isn't required |
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.
If a config is extending another one, there's no reason for it to have anything in particular defined, so maybe these could be RecursivePartial<LH.Config.Json>
, but we don't want to apply that to e.g. defaultConfig
. So we'll have to figure out a good way to conditionally apply it another day.
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.
Maybe we have to split the full config typedef from the valid config typedef?
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.
Maybe we have to split the full config typedef from the valid config typedef?
yeah, that seems like that might be the only decent way to do it without making the full config typedef useless
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.
LGTM!
@@ -19,6 +20,7 @@ module.exports = { | |||
audits: [ | |||
'byte-efficiency/unused-javascript', | |||
], | |||
// @ts-ignore TODO(bckenny): type extended Config where e.g. category.title isn't required |
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.
Maybe we have to split the full config typedef from the valid config typedef?
This was flagged testing the typescript nightly against the current code base.
LH.Config.Category.description
andLH.Config.Group.description
should both be optional as they are in the LHR, andLH.Config.Category.manualDescription
should also exist.Also adds type annotations to the files themselves so that they're checked directly, rather than indirectly through their use in
config.js
.