Prerequisites: node v8, docker run
is available and npx exists.
- In your terminal
cd
to the folder where yourcompiled.apib
is. - Execute
docker run -i bugyik/apib2json < compiled.apib | npx https://gist.github.com/stipsan/77de06507d74442c82916477f2d59722 > api.d.ts
. The first time it runs it might take a little time to download the docker image but subsequent runs should be quick. - Load the generated typings 😉 perhaps using
/// <reference path="../api.d.ts" />
- Then in your resolvers:
const {body}: {body: RestEndpoints.GetUserResponse} = await got(endpoint)
- As you type
body.
vscode will autocomplete it for you with whatever that endpoint is offering.