-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Conversation
Seems like #34793 was already fixed, but this loses the ability for us to reuse type aliases. |
src/compiler/checker.ts
Outdated
@@ -17925,7 +17925,7 @@ namespace ts { | |||
} | |||
} | |||
} | |||
else if (isGenericMappedType(target) && !target.declaration.nameType) { | |||
else if (isGenericMappedType(target) && (!target.declaration.nameType || relation === comparableRelation)) { |
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.
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.
Seems like this should close #31104, as it addresses the suggestion I made in #31104 (comment) |
Yeah, the issue ref is in the OP now. |
@typescript-bot perf test this |
Heya @weswigham, I've started to run the perf test suite on this PR at 743f49a. You can monitor the build here. Update: The results are in! |
Heya @weswigham, I've started to run the parallelized community code test suite on this PR at 743f49a. You can monitor the build here. |
Heya @weswigham, I've started to run the extended test suite on this PR at 743f49a. You can monitor the build here. |
Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 743f49a. You can monitor the build here. |
@weswigham Here they are:Comparison Report - master..42524
System
Hosts
Scenarios
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
@DanielRosenwasser when was #34793 "already fixed"? I still see it same as I always did :( |
It might not have - have you checked the nightlies with My assumption was it would've been fixed with #42284 where we'll preserve the origin types to remember that something was written as |
@DanielRosenwasser ah ok, no I haven't checked any nightlies, I badly assumed you meant in a public release. I'll check and report back. |
Unfortunately, we never finished reviewing this PR. It is pretty old now, so I'm going to close it to reduce the number of open PRs. |
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 swapOmit
over to use a template and be homomorphic, and fix two longstanding issues with one PR.Fixes #36981
Fixes #34793
Fixes #31104