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