Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better typescript support #284

Open
AlexKratky opened this issue Nov 10, 2024 · 1 comment
Open

Better typescript support #284

AlexKratky opened this issue Nov 10, 2024 · 1 comment

Comments

@AlexKratky
Copy link

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

@JoaoPedroAS51
Copy link
Collaborator

JoaoPedroAS51 commented Nov 14, 2024

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[]
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants