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

misc: fix PhaseArtifact type to include Stacks #12280

Merged
merged 1 commit into from
Mar 22, 2021
Merged

Conversation

brendankenny
Copy link
Member

@brendankenny brendankenny commented Mar 22, 2021

fix for the problem in #12274 (comment) We could also merge into #12274 instead of master if that's better for anyone.

The problem wasn't detected because the elements of MetaElements have all optional properties, so in theory could match any object (like a DetectedStack) so long as there weren't any conflicting types (e.g. if somehow there was content?: string in MetaElement but content: number in DetectedStack), which there aren't.

Typescript throws in one additional check for protection against accidental cases like this by ensuring that the source and target types have to have at least one property in common when one of the two types is all optional, but MetaElement has name?: string and DetectedStack has name: string, so there's no problem there.

The error in #12274 occurs when adding a new required property to MetaElement, so DetectedStack can no longer be mistaken for an element of MetaElements (same thing happens if you make any MetaElement property except name required).

@connorjclark
Copy link
Collaborator

nice, thanks for the assist!

I think merging this into the other PR's branch would be best.

@brendankenny brendankenny merged commit bf0771b into master Mar 22, 2021
@brendankenny brendankenny deleted the metatscfix branch March 22, 2021 20:24
@brendankenny
Copy link
Member Author

oh, whoops, I read your merge comment the opposite way it intended, sorry :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants