The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
When trying to use a customType or enum as input to a query, TypeScript is not happy.
const schema = a
.schema({
Foo: a.enum(["BAR", "BAZ"]),
customQuery: a.query().arguments({
foo: a.ref("Foo") // Type 'RefType<RefTypeArgFactory<"Foo">, never, undefined>' is not assignable to type 'ModelField<any, any> | EnumType<EnumTypeParamShape>'
})
})
This won't compile because of the type error. However the functionality seems to work just fine, so if you cast it to any it will successfully deploy and it works as expected.
Hi @ErlendHer thanks for raising this. I've marked it as a feature request for the team to consider. At the moment, arguments must be a scalar or an enum (inline).
Environment information
Description
When trying to use a customType or enum as input to a query, TypeScript is not happy.
This won't compile because of the type error. However the functionality seems to work just fine, so if you cast it to
any
it will successfully deploy and it works as expected.