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 problem in graphql.d.ts #1

Open
adriatic opened this issue Jul 31, 2022 · 2 comments
Open

TypeScript problem in graphql.d.ts #1

adriatic opened this issue Jul 31, 2022 · 2 comments

Comments

@adriatic
Copy link
Owner

adriatic commented Jul 31, 2022

I reported this redwoodjs/redwood#6078 issue, discovered in the context of trying to create a TypeScript version of the Redwood Tutorial. At that time I was not aware of the same effort by @rushabhhere. As I was having the similar issue with a different application (redwood-stripe) I decided to convert the redwood tutorial app to typescript hoping to better understand my original problem, described below


In order to reproduce my issue create any TypeScript app

yarn create redwood-app --ts ./myapp

Observe the just generated file graphql.d.ts in api/types folder, the definition of the scalars type

/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
  ID: string;
  String: string;
  Boolean: boolean;
  Int: number;
  Float: number;
  BigInt: number;
  Date: string;
  DateTime: string;
  JSON: Prisma.JsonValue;
  JSONObject: Prisma.JsonObject;
  Time: string;
};

This same code rendered by VSCode is:

image

The issue with JSON and JSONObject is

image

Seemingly an import statement is missing 😺

@Tobbe
Copy link

Tobbe commented Jul 31, 2022

Yeah, this is not a problem with any particular RW project. If we should/could fix it, it'd be in the framework code for type generation. I'm not sure what change needs to be made though. If you could dig into it and find a solution that'd be awesome :)

@adriatic
Copy link
Owner Author

@Tobbe - I believe that I did find the change and it is trivial - please check my explanation to @rushabhhere (https://github.com/rushabhhere) so I do not pollute all discussions with my comments 😸 .

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

No branches or pull requests

2 participants