Defer index types on remapping mapped types#55140
Conversation
src/compiler/checker.ts
Outdated
| const objectType = (type as IndexedAccessType).objectType; | ||
| const indexType = (type as IndexedAccessType).indexType; | ||
| if (isTypeAssignableTo(indexType, getIndexType(objectType, IndexFlags.None))) { | ||
| if (isTypeAssignableTo(indexType, getIndexType(objectType, IndexFlags.NoRemappingMappedTypeDeferral))) { |
There was a problem hiding this comment.
I kinda expected that I would have to pass this at more locations. Given the fact that this is the only call site using this... maybe I just should remove this IndexFlags.NoRemappingMappedTypeDeferral and perform the targeted simplification of keyof RemappingMappedType here to pass it to the isTypeAssignableTo.
There was a problem hiding this comment.
That would probably be better - IndexFlags originally only existed to support the keyofStringsOnly flag, and its' other uses have kind of become a convenience. With keyofStringsOnly likely to go away soonish, it'd be nice if we could stop having all these quiet variant index types.
There was a problem hiding this comment.
pushed out this change
src/compiler/checker.ts
Outdated
| const objectType = (type as IndexedAccessType).objectType; | ||
| const indexType = (type as IndexedAccessType).indexType; | ||
| if (isTypeAssignableTo(indexType, getIndexType(objectType, IndexFlags.None))) { | ||
| if (isTypeAssignableTo(indexType, getIndexType(objectType, IndexFlags.NoRemappingMappedTypeDeferral))) { |
There was a problem hiding this comment.
That would probably be better - IndexFlags originally only existed to support the keyofStringsOnly flag, and its' other uses have kind of become a convenience. With keyofStringsOnly likely to go away soonish, it'd be nice if we could stop having all these quiet variant index types.
src/compiler/checker.ts
Outdated
| const enum MappedTypeNameTypeKind { | ||
| None = 0, | ||
| Filtering = 1 << 0, | ||
| Remapping = 1 << 1, |
There was a problem hiding this comment.
Why is this a flags enum? I can't see anywhere we actually combine multiple flags - in fact, it seems to me like a mapped type can only be one, given the implementation of getMappedTypeNameTypeKind.
There was a problem hiding this comment.
I had some composite values here before but removed them at the end since I didn't actually use them anywhere. Refactored this now to be a non-flag enum
…-on-remapping-mapped-types
…-on-remapping-mapped-types
…-on-remapping-mapped-types
|
@typescript-bot test this |
|
Heya @weswigham, I've started to run the regular perf test suite on this PR at 9f95520. You can monitor the build here. Update: The results are in! |
|
Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 9f95520. You can monitor the build here. Update: The results are in! |
|
Heya @weswigham, I've started to run the diff-based top-repos suite on this PR at 9f95520. You can monitor the build here. Update: The results are in! |
|
@weswigham Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@weswigham Here are the results of running the top-repos suite comparing Everything looks good! |
|
Hey @weswigham, it looks like the DT test run failed. Please check the log for more details. |
|
@typescript-bot run dt |
|
Heya @sandersn, I've started to run the parallelized Definitely Typed test suite on this PR at 847cb6d. You can monitor the build here. Update: The results are in! |
|
Hey @sandersn, the results of running the DT tests are ready. |
fixes #55129