Why each scalar `MakeNullable`?
I have a graphQL schema:
Details
# Directs the executor to query only when the field exists.
directive @ifdef on FIELD
type AccessToken {
token: String!
scopes: [String!]!
expiresAt: DateTime!
registrationId: UUID!
registration: UserRegistration
}
type Application {
id: UUID!
isDev: Boolean!
redirectUri: [String!]!
title: String!
allowedRegistrations: Boolean!
registrations: [UserRegistration!]!
}
input ApplicationCreate {
title: String!
redirectUri: [String!]!
isDev: Boolean
allowedRegistrations: Boolean
}
type ApplicationSecret {
id: UUID!
isDev: Boolean!
redirectUri: [String!]!
title: String!
allowedRegistrations: Boolean!
# Allowed to read only after application is created
secretKey: String!
}
# Implement the DateTime<Utc> scalar
#
# The input/output is a string in RFC3339 format.
scalar DateTime
type Mutation {
applicationCreate(form: ApplicationCreate!): ApplicationSecret!
applicationRegenerateSecret(applicationId: UUID!): ApplicationSecret
registerRequestCreate(email: String!): RegisterRequest!
registerRequestDeleteAllForEmail(email: String!): Int!
}
type Query {
version: String!
accessTokens: [AccessToken!]!
application(id: UUID!): Application
applications: [Application!]!
registerRequests: [RegisterRequest!]!
users: [User!]!
userByEmail(email: String!): User
userById(userId: UUID!): User
}
type RegisterRequest {
email: String!
code: String!
expiresAt: DateTime!
}
# A UUID is a unique 128-bit number, stored as 16 octets. UUIDs are parsed as Strings
# within GraphQL. UUIDs are used to assign unique identifiers to entities without requiring a central
# allocating authority.
#
# # References
#
# * [Wikipedia: Universally Unique Identifier](http://en.wikipedia.org/wiki/Universally_unique_identifier)
# * [RFC4122: A Universally Unique IDentifier (UUID) URN Namespace](http://tools.ietf.org/html/rfc4122)
scalar UUID
type User {
id: UUID!
email: String!
canonicalEmail: String!
firstName: String!
lastName: String!
registrations: [UserRegistration!]!
}
type UserRegistration {
id: UUID!
# Field renamed from `client_id`
applicationId: UUID!
createdAt: DateTime!
userId: UUID!
user: User
application: Application
accessTokens: [AccessToken!]!
}
As I see Application.title has a strong String! type.
But if I want to fetch it via resolved, I see string | undefined:

The same via useQuery():

Why there string | undefined on String! type?
https://gqty.dev/docs/intro/how-it-works#skeleton-render--values
@PabloSzx Can I disable this behaviour? I don't use react client at all. I'm using refetch and resolved
@PabloSzx Can I disable this behaviour? I don't use react client at all. I'm using
refetchandresolved
https://gqty.dev/docs/client/helper-functions#type-casters
You can use type casters, but read the warnings mentioned in the docs
@PabloSzx , I wonder, why is that not the default? I mean, the docs do mention: This next example is a perfectly safe place to use it,.
@PabloSzx , I wonder, why is that not the default? I mean, the docs do mention: This next example is a perfectly safe place to use it,.
because in that example is safe to do, but that example doesn't cover all the possibilities of gqty usage, and the priority is giving type-safety, and in much other scenarios doing type-casting is not safe