I was surprised to find there is no way to declare a custom scalar type with it's actual value type?
When declaring something like:
It's all down to run-time type-checking for actual Date literal values.
I was expecting something like:
vs
I understand we can't statically verify the actual contents of e.g. a Date beyond the fact that it's a String or Int, but a literal could at least be validated (statically) for the correct literal value type, which would be better than nothing, wouldn't it?
At run-time, of course, there would be further validatio - but statically, a scalar is almost like a type alias, and could at least be validated as such, I think?
(Sorry if this has already been asked - it seems like this would be a common question for someone learning GraphQL, but I've read through dozens of issues and I couldn't find this question asked or answered.)
I was surprised to find there is no way to declare a custom scalar type with it's actual value type?
When declaring something like:
It's all down to run-time type-checking for actual
Dateliteral values.I was expecting something like:
vs
I understand we can't statically verify the actual contents of e.g. a
Datebeyond the fact that it's aStringorInt, but a literal could at least be validated (statically) for the correct literal value type, which would be better than nothing, wouldn't it?At run-time, of course, there would be further validatio - but statically, a scalar is almost like a type alias, and could at least be validated as such, I think?
(Sorry if this has already been asked - it seems like this would be a common question for someone learning GraphQL, but I've read through dozens of issues and I couldn't find this question asked or answered.)