Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript definitions generated with wrong case #3147

Open
2 of 4 tasks
domusofsail opened this issue Feb 13, 2024 · 2 comments
Open
2 of 4 tasks

TypeScript definitions generated with wrong case #3147

domusofsail opened this issue Feb 13, 2024 · 2 comments

Comments

@domusofsail
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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:

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'?

image

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.1
apollo-server-express: N/A
apollo-server-fastify: N/A

NestJS version

10.0.0

Node.js version

20.11.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

@domusofsail
Copy link
Author

Ok, I'll try to do my best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants