rajeshtva's avatar

share data type between laravel - vue js rest api.

I have a laravel backend + vue 3 application with typescript setup. Project is using rest api. Now i want to share datatype of key-value pairs present in api response. so that i do not have typescript type-checking issues on frontend.

So what is the best way to achieve it?

0 likes
1 reply
MohamedTammam's avatar

It's doesn't related to Laravel as long as you're using consistent types in the API. You need to define your types in TypeScript normally for what you expect the API response would be.

The website will convert your JSON response to a TypeScript, it can make your work easier: https://jsonformatter.org/json-to-typescript

Please or to participate in this conversation.