GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Compute writeType from set accessors for union and intersection properties by andrewbranch · Pull Request #47674 · microsoft/TypeScript

Conversation

@andrewbranch

@andrewbranch Andrew Branch (andrewbranch) commented Jan 31, 2022

Copy link
Copy Markdown
Member

Fixes #45376

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Andrew Branch (andrewbranch) added 2 commits January 31, 2022 10:28
@andrewbranch
Compute write type from set accessors for union and intersection prop…
a16e00b
…erties
@andrewbranch
Add test for deferred writeType
91997ff
@andrewbranch
Andrew Branch (andrewbranch) requested review from Ryan Cavanaugh (RyanCavanaugh) and Wesley Wigham (weswigham) January 31, 2022 18:37
@typescript-bot TypeScript Bot (typescript-bot) assigned Andrew Branch (andrewbranch) Jan 31, 2022
@typescript-bot TypeScript Bot (typescript-bot) added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jan 31, 2022
andrewbranch
Andrew Branch (andrewbranch) commented Jan 31, 2022
View reviewed changes
Comment thread src/compiler/checker.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@andrewbranch
Always check for writeType of symbol
03ec07b
weswigham
Wesley Wigham (weswigham) approved these changes Feb 8, 2022
View reviewed changes
RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) approved these changes Feb 8, 2022
View reviewed changes
@andrewbranch
Andrew Branch (andrewbranch) merged commit c5b1011 into microsoft:main Feb 8, 2022
@andrewbranch
Andrew Branch (andrewbranch) deleted the bug/45376 branch February 8, 2022 20:57
whzx5byb
whzx5byb reviewed Aug 2, 2022
View reviewed changes
Comment thread src/compiler/checker.ts
if (!links.writeType && links.deferralWriteConstituents) {
Debug.assertIsDefined(links.deferralParent);
Debug.assertIsDefined(links.deferralConstituents);
links.writeType = links.deferralParent.flags & TypeFlags.Union ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents);

@whzx5byb whzx5byb Aug 2, 2022

Copy link
Copy Markdown

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.

Shouldn't the write type of a union be resolved into an intersection type? Just like the way mentioned in #30769

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@andrewbranch Andrew Branch (andrewbranch) Aug 2, 2022

Copy link
Copy Markdown
Member Author

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 you come up with a code example that doesn’t work the way you expect, feel free to file an issue.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@whzx5byb whzx5byb Aug 2, 2022

Copy link
Copy Markdown

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 you come up with a code example that doesn’t work the way you expect, feel free to file an issue.

Please have a look at the unsound behavior described in #50142. A comment indicates that it should be treated using the same rule of #30769.

I'm not quite sure but I guess it could have relation to this PR, where the write type of a union is not resolved into an intersection, but a union.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@fatcerberus Bruce Pascoe (fatcerberus) Aug 4, 2022

Copy link
Copy Markdown

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.

FWIW there’s a second complication in play in #50142: subtype reduction. Subtype reduction means that NullableProp | NonNullableProp is likely to be reduced to just the former, making #30769 a moot point.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Andarist Mateusz Burzyński (Andarist) mentioned this pull request Dec 29, 2023
Fixed union/intersection write types #56895
Closed
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@weswigham Wesley Wigham (weswigham) weswigham approved these changes
@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) RyanCavanaugh approved these changes
+2 more reviewers
@fatcerberus Bruce Pascoe (fatcerberus) fatcerberus left review comments
@whzx5byb whzx5byb whzx5byb left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@andrewbranch Andrew Branch (andrewbranch)

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

PR Backlog
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Union of variant setters uses getter type for assignment

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@andrewbranch @weswigham @fatcerberus @whzx5byb @RyanCavanaugh @typescript-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.