Allow scalarToLiteralMapping to declare TS type for extended scalar type #836
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.
As far as I've been able to deduce there's no need to jump to the
type
's firstbase
type to determine the TS literal value.This is because the function already jumps to the
type
'smaterial_id
, which has already worked out the "base concrete type".https://github.com/edgedb/edgedb-js/blob/dfcf3d48f74fd78c47146b505a4e942d4b33d849/packages/driver/src/reflection/queries/types.ts#L165-L169
https://github.com/edgedb/edgedb-js/blob/dfcf3d48f74fd78c47146b505a4e942d4b33d849/packages/driver/src/reflection/queries/types.ts#L139-L144
This change resulted in no changes in my generated query builder, schema, or query files, so I'm fairly confident in it. Though not 100% and I don't know the difference between
bases
andancestors
(maybe they are the same forScalarType
?).With that change in place I was able to add the logical change: allowing
scalarToLiteralMapping
to declare scalars that should use their own TS literal type instead of the base type.My use case is this: