-
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(fr): more precise AnyFRInterface types #12622
Conversation
@@ -108,7 +108,9 @@ function resolveArtifactsToDefns(artifacts, configDir) { | |||
throw new Error(`${gatherer.instance.name} gatherer does not support Fraggle Rock`); | |||
} | |||
|
|||
/** @type {LH.Config.ArtifactDefn<LH.Gatherer.DependencyKey>} */ | |||
/** @type {LH.Config.AnyArtifactDefn} */ | |||
// @ts-expect-error - Typescript can't validate the gatherer and dependencies match |
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.
this is the only place I couldn't figure out how to solve.
🤓 🔫 @brendankenny if you're interested :)
the only thing I could think was to re-validate that resolveArtifactDependencies
matches outside the function, but that seemed excessive
Co-authored-by: Adam Raine <[email protected]>
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
Summary
Fixes the issue raised in #12619
The type violations were in fact valid and stemmed from my abuse of
Interface<AllPossibleKeys>
to be a substitute forInterface<Key1> | Interface<Key2> | Interface<Key3>
. I introducedAnyInterface
types to more accurately reflect when a function accepts or returns any possible artifact/gatherer/dependency object instead. This still has the limitation that it doesn't programmatically generate the combinatorial versions, but I haven't bumped into a scenario where the handling differs/matters yet.Solves @adamraine 's original point (see screenshot)
Related Issues/PRs
fixes #12619
ref #11313