Open kevinbarabash opened 2 years ago
Another use case is document.querySelector
and document.querySelectorAll
.
We might also want a way to declare a type Pathname
that admits all strings that are valid pathnames. Being able to parse a string in such a way that we can return an object type with the URL params is more powerful.
One use case for string literals would be routing, e.g.
could be used to correctly type
params
as{id: string, entity: "posts" | "comments"}
automatically.Tagged literals such as:
could return a
GqlOpertaion<TData, TVariables>
type whereTData
andTVariables
are inferred with the correct types based on the operation inside thegql
tagged template literal and the corresponding schema.