The Wayback Machine - https://web.archive.org/web/20210127224100/https://github.com/microsoft/TypeScript/pull/42524
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

Use homomorphic templated type for Omit #42524

Open
wants to merge 1 commit into
base: master
from

Conversation

@weswigham
Copy link
Member

@weswigham weswigham commented Jan 27, 2021

Omit as written today is non-homomorphic, so the original keys are unrecoverable when an index type subtype reduces with a key type. however, with #41976 in place, we can swap Omit over to use a template and be homomorphic, and fix two longstanding issues with one PR.

Fixes #36981
Fixes #34793
Fixes #31104

@DanielRosenwasser
Copy link
Member

@DanielRosenwasser DanielRosenwasser commented Jan 27, 2021

Seems like #34793 was already fixed, but this loses the ability for us to reuse type aliases.

@@ -17925,7 +17925,7 @@ namespace ts {
}
}
}
else if (isGenericMappedType(target) && !target.declaration.nameType) {
else if (isGenericMappedType(target) && (!target.declaration.nameType || relation === comparableRelation)) {

This comment has been minimized.

@weswigham

weswigham Jan 27, 2021
Author Member

Without this change and the bit below, you couldn't cast between an Omit of something and that something. That mapped types with nameType fields currently have no generic relations is a place we should probably improve upon anyway, however this is the minimal change required to get that comparable relation to work as expected.

@DanielRosenwasser
Copy link
Member

@DanielRosenwasser DanielRosenwasser commented Jan 27, 2021

Seems like this should close #31104, as it addresses the suggestion I made in #31104 (comment)

@weswigham
Copy link
Member Author

@weswigham weswigham commented Jan 27, 2021

Yeah, the issue ref is in the OP now.

@weswigham
Copy link
Member Author

@weswigham weswigham commented Jan 27, 2021

@typescript-bot perf test this
@typescript-bot run dt
@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

@typescript-bot typescript-bot commented Jan 27, 2021

Heya @weswigham, I've started to run the perf test suite on this PR at 743f49a. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

@typescript-bot typescript-bot commented Jan 27, 2021

Heya @weswigham, I've started to run the parallelized community code test suite on this PR at 743f49a. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

@typescript-bot typescript-bot commented Jan 27, 2021

Heya @weswigham, I've started to run the extended test suite on this PR at 743f49a. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

@typescript-bot typescript-bot commented Jan 27, 2021

Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 743f49a. You can monitor the build here.

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