具有:
// api.js
export function getLayout(){
return axios.get('/api/layout').then(res => res.data)
}
// api.d.ts
declare interface JSONResponse {
meta: object,
data: Array<Field>
}
export declare function getLayout():Promise<any> // Promise<any>.then<JSONResponse>??
我希望VSCode建议以下
getLayout().then(json => {
json.data // suggest data is of type Array<Fields>
})
这可能吗?