Improve typings (#813)

The ApiResponse now accepts a generics that defaults to any, same for every API method that might need a body.
This commit is contained in:
Tomas Della Vedova
2019-04-10 11:40:25 +02:00
committed by delvedor
parent fb365c9adf
commit e6f0d272ca
7 changed files with 3488 additions and 111 deletions

View File

@ -74,10 +74,10 @@ export interface Generic {
}
const code = `
export interface ${name[0].toUpperCase() + name.slice(1)} extends Generic {
export interface ${name[0].toUpperCase() + name.slice(1)}${body ? '<T = any>' : ''} extends Generic {
${partsArr.map(genLine).join('\n ')}
${paramsArr.map(genLine).join('\n ')}
${body ? `body${body.required ? '' : '?'}: any;` : ''}
${body ? `body${body.required ? '' : '?'}: T;` : ''}
}
`