Skip to content

Conversation

weswigham
Copy link
Member

Fixes #46814

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Dec 8, 2021
@andrewbranch
Copy link
Member

What mental model should I have that would help me remember which of {a: whatever} and {readonly a: whatever} is a subtype of the other?

@weswigham
Copy link
Member Author

If readonly were to affect assignability (it doesn't, this is hypothetical), it would be safe to assign a non-readonly type to a readonly one because all usages of the readonly one only read, which is obviously also safe for the mutable form, whereas if you were to assign a readonly type to a non-readonly one, it might get written to, which'd be bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Inferred type of union with readonly properties is dependent on declaration order
4 participants