vue-api-query icon indicating copy to clipboard operation
vue-api-query copied to clipboard

Better typescript support

Open AlexKratky opened this issue 1 year ago • 1 comments

It would be nice to have better typescript support. Like I have defined attributes in model, but the IDE will not detect that the property is that type of model.

image image

image

AlexKratky avatar Nov 10 '24 13:11 AlexKratky

Hi! That's because responses might be wrapped in data, so we don't know if the type is Event[] or WrappedResponse<Event[]>. Try using $get() to automatically unwrap it.

new Event().$get().then(response => {
  response // Now the response type will be Event[]
})

JoaoPedroAS51 avatar Nov 14 '24 20:11 JoaoPedroAS51