-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
Description
In my data model I use Postgresql "bigint" ID-s and and tried to use the same types in an action like this:
type Mutation {
doSomething (
arg: SampleInput!
): SampleOutput
}
scalar bigint
input SampleInput {
id : bigint!
}
type SampleOutput {
id : bigint!
}For this I tried generating code using the typescript-express codegen:
type Maybe<T> = T | null
type bigint = string
type Mutation = {
doSomething?: Maybe<SampleOutput>
}
type doSomethingArgs = {
arg: SampleInput
}
type SampleOutput = {
id: bigint
}
type SampleInput = {
id: bigint
}The
type bigint = stringline results in a Type alias name cannot be 'bigint'.(2457) typescript error. It turns out bigint is a reserved javascript symbol.
Here's just the offending line in a ts playground
https://www.typescriptlang.org/play?ts=4.1.3#code/KYDwDg9gTgLgBDAnmYcBGBLA5hgdvAXjgGcYo8sAoIA
https://graphql-code-generator.com/ solves this by defining and using scalar types like this:
export type Scalars = {
bigint: any;
};
export type SampleInput = {
id: Scalars['bigint'];
};Would it be possible to make something similar in tha Hasura action codegen so that the output won't have clashes with reserved names?
jesse-savary, lukepolo and ueda000