aws-amplify / aws-amplify/amplify-codegen
Adding a required "simple" data type return type on a graphql query makes codegen produce invalid typescript code
- Dominant language
- TypeScript
- Stars
- 59
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/master/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
### How did you install the Amplify CLI?
npm
### If applicable, what version of Node.js are you using?
14.15.3
### Amplify CLI Version
7.6.5
### What operating system are you using?
mac
### Amplify Categories
api
### Amplify Commands
codegen
### Describe the bug
Try this graphql query
```
updateDate(
newDate: AWSDateTime!
): AWSDateTime!
@function(name: "MyGraphQLResolverFn-${env}")
```
The typescript codegen code produced will be:
```
async UpdateDate(
newDate: string
): Promise
```
But the type ```UpdateDateQuery``` won't be defined in API.service.ts
If I remove the exclamation mark in the AWSDateTime return type, then return type is accurately Promise. So why can't I get it to return ```Promise```?
### Expected behavior
generated code should return ```Promise```
### Reproduction steps
See above description
### GraphQL schema(s)
See above
### Log output
```
# Put your logs below this line
```
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.