hasura / hasura/graphql-engine
actions typescript codegen produces types with incorrect underscores
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
Just trying out actions and liking it a lot so far! I am running a typescript/koa backend to serve the actions and noticed you have type definitions under `typescript-zeit` so decided to incorporate this! However it looks like the types are malformed with strange underscores that are not mirrored in the handler code.
initialize_team.ts
```typescript
import { NowRequest, NowResponse } from '@now/node';
import { MutationInitializeTeamArgs } from './hasuraCustomTypes';
import fetch from "node-fetch"
// Request Handler
const handler = async (req: NowRequest, res: NowResponse) => {
// get request input
const { userId, name, description }: MutationInitializeTeamArgs = req.body.input;
// run some business logic
/*
// In case of errors:
return res.status(400).json({
message: "error happened"
})
*/
// success
return res.json({
affected_rows: ""
})
}
export default handler;
```
hasuraCustomTypes.ts
``` typescript
export type Maybe = T | null;
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
};
export type InitializeTeamOutput = {
__typename?: 'InitializeTeamOutput';
affected_rows: Scalars['Int'];
};
export type Mutation = {
__typename?: 'Mutation';
initialize_team?: Maybe;
};
export type MutationInitialize_TeamArgs = {
userId: Scalars['Int'];
name: Scalars['String'];
description?: Maybe;
};
```
Notice the strange underscores in the types.
I am running v1.2.0-beta.3
Contributor guide
Assessment
This issue has not been assessed yet.