feat(common): add TypeInfo converter hints - #2251
Merged
Merged
Conversation
This was referenced Jul 23, 2026
THardy98
force-pushed
the
feat/ts-type-hints-converter
branch
from
July 23, 2026 17:06
88597d8 to
5e6d348
Compare
THardy98
force-pushed
the
feat/ts-type-hints-mapper
branch
from
July 23, 2026 17:06
c1982de to
8c124a3
Compare
THardy98
force-pushed
the
feat/ts-type-hints-converter
branch
from
July 23, 2026 17:29
5e6d348 to
12bc6f0
Compare
THardy98
force-pushed
the
feat/ts-type-hints-mapper
branch
from
July 23, 2026 17:29
8c124a3 to
b7eb29b
Compare
THardy98
force-pushed
the
feat/ts-type-hints-converter
branch
from
July 23, 2026 18:42
12bc6f0 to
0bb7594
Compare
THardy98
force-pushed
the
feat/ts-type-hints-mapper
branch
from
July 23, 2026 18:42
b7eb29b to
d655488
Compare
THardy98
force-pushed
the
feat/ts-type-hints-converter
branch
2 times, most recently
from
July 23, 2026 19:06
9a79de3 to
77066f8
Compare
THardy98
force-pushed
the
feat/ts-type-hints-mapper
branch
from
July 23, 2026 19:38
d655488 to
f6577e8
Compare
THardy98
force-pushed
the
feat/ts-type-hints-converter
branch
2 times, most recently
from
July 24, 2026 16:44
4d9d31e to
32f28fb
Compare
THardy98
force-pushed
the
feat/ts-type-hints-mapper
branch
from
July 24, 2026 16:47
f6577e8 to
eb968c5
Compare
THardy98
force-pushed
the
feat/ts-type-hints-converter
branch
4 times, most recently
from
July 25, 2026 11:57
06abf8c to
1907b99
Compare
THardy98
force-pushed
the
feat/ts-type-hints-mapper
branch
from
July 30, 2026 16:47
eb968c5 to
22e99c3
Compare
THardy98
marked this pull request as ready for review
July 30, 2026 16:48
tconley1428
reviewed
Jul 30, 2026
THardy98
enabled auto-merge (squash)
July 30, 2026 19:18
chris-olszewski
left a comment
Member
There was a problem hiding this comment.
It would be nice to have a test that exercises a TypeInfo with both a transfer type converter and a converter hint.
| * @experimental | ||
| */ | ||
| export interface TypeInfo<T = unknown> { | ||
| export interface TypeInfo<T = unknown, D = T> { |
Member
There was a problem hiding this comment.
Should D be passed as a generic to TransferTypeConverter so the mapping function typings line up with the type hint?
Contributor
Author
There was a problem hiding this comment.
Yeah I think so - i've added in the last commit.
| * Converts a {@link Payload} back to a value. | ||
| */ | ||
| fromPayload<T>(payload: Payload, context?: SerializationContext): T; | ||
| fromPayload<T>(payload: Payload, context?: SerializationContext, hint?: ConverterHint): T; |
Member
There was a problem hiding this comment.
Should we restrict converter hints to ones that are branded with the expected type? I can't think of a reason we would want to be more permissive here.
Suggested change
| fromPayload<T>(payload: Payload, context?: SerializationContext, hint?: ConverterHint): T; | |
| fromPayload<T>(payload: Payload, context?: SerializationContext, hint?: ConverterHint<T>): T; |
Contributor
Author
There was a problem hiding this comment.
Yup - added in last commit
THardy98
force-pushed
the
feat/ts-type-hints-mapper
branch
from
July 31, 2026 01:21
4152cfb to
d9e55da
Compare
chris-olszewski
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
Extended
TypeInfo<T, D>with an optionalConverterHint<D>and added optional hint parameters to payload-converter serialization methods. Payload converters may expose the experimentalvalidateConverterHintmethod, andCompositePayloadConverteruses it to select or validate the converter that receives a hint.The TypeInfo conversion helpers now forward hints after applying transfer conversion. This is PR 2 of the stack and depends on #2250; Nexus operation integration follows separately.
Why?
Transfer conversion is sufficient for formats such as JSON, but some payload converters require format-specific runtime information. Protobuf deserialization, for example, needs the message type in addition to the decoded bytes.
Conversions without a hint retain their existing best-effort behavior. This API is experimental and requires no rollout or manual steps.
Checklist
Closes: N/A
How was this tested: Common build and all 38 Common tests; focused JSON transfer conversion and Protobuf converter-hint coverage; ESLint; Prettier; and
ts-prune.Any docs updates needed? No; documentation will accompany the completed experimental API.