How it works by rules?
By default (useServerTypes by default always is true) it expects server on http://127.0.0.1:8000/graphql and generates types based on types provided by this one. If some primitive type in not provided by server, it generates the type based on naming rule. If the server doesn't exists, it returns warning about an server unavailability and generates types purely based on naming rules. By default the rules look so:
rules = {
string: ['Name', 'Title', 'Date', 'Time'], // endsWith
bool: ['is'], // startsWith
number: ['Id', 'Count', 'Sum'] // endsWith
}
export const GET_DIALOGS_INIT = gql`
query profileInfo {
users {
username,
firstName
},
dialogs{
id,
title
}
}
`;
export type profileInfo = {
users: Array<{
username: string,
firstName: string,
}>,
dialogs: Array<{
id: number,
title: string,
}>,
};
PS:
npm run generate for graphql types generation from backend. See more detail here.