In a schema-first approach, given a GraphQL schema having a lowercase type, the Typescript definitions generated have inconsistent case between class definition and method return types.
Given the following schema:
type person {
name: String
surname: String
}
type Query {
persons(search: String!): [person!]!
}
the following Typescript gets generated:
export class Person {
name?: Nullable<string>;
surname?: Nullable<string>;
}
export abstract class IQuery {
abstract persons(search: string): person[] | Promise<person[]>;
}
resulting in a Typescript error TS2552: Cannot find name 'person'. Did you mean 'Person'?
Is there an existing issue for this?
Current behavior
In a schema-first approach, given a GraphQL schema having a lowercase type, the Typescript definitions generated have inconsistent case between class definition and method return types.
Given the following schema:
the following Typescript gets generated:
resulting in a Typescript error TS2552: Cannot find name 'person'. Did you mean 'Person'?
Minimum reproduction code
https://github.com/domusofsail/nestjs-graphql-example
Steps to reproduce
pnpm start:dev
Expected behavior
Either class generated lowercase, or return type generated uppercase.
Package version
12.1.1
Graphql version
graphql
: 16.8.1apollo-server-express
: N/Aapollo-server-fastify
: N/ANestJS version
10.0.0
Node.js version
20.11.0
In which operating systems have you tested?
Other
No response