Arguments
This example shows how to write field arguments in TypeScript interface.
ts
// Our website uses Vitepress+Twoslash. Twoslash does not discover the generated Graffle modules.
// Perhaps we can configure Twoslash to include them. Until we figure that out, we have to
// explicitly import them like this.
import './graffle/modules/global.js'
// ---cut---
import { Graffle } from './graffle/$.js'
const graffle = Graffle.create()
const pokemons = await graffle.query.pokemons({
$: { filter: { name: { in: [`Pikachu`, `Charizard`] } } },
name: true,
trainer: { name: true },
})
console.log(pokemons)
Outputs
json
[
{
"name": "Pikachu",
"trainer": {
"name": "Ash"
}
},
{
"name": "Charizard",
"trainer": {
"name": "Ash"
}
}
]