The API is GraphQL and created with Php/Laravel. I use typescript in my Nuxt project, does it help to write less test? if yes, could you explain how, please?
I will write a post with a full explain, but in short :
You generate TypeScript typing from GraphQL using tools.
Add/Replace the result files in your client project.
Type your fetch's result with generated files.
// GeneratedtypedataType={field:string;};asyncfunctionfetchData():Promise<dataType>{constfetchResult=awaitfetch("dataUrl");constjson=awaitfetchResult.json();returnjsonasdataType;}asyncfunctiontestIt(){constres=awaitfetchData();console.log(res.field);// get a typescript error if field no more in dataType}
Each time you update your API, make the 2 first step. If there is changes, you're client won't compile (if he use an out of date field).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The API is GraphQL and created with Php/Laravel. I use typescript in my Nuxt project, does it help to write less test? if yes, could you explain how, please?
I will write a post with a full explain, but in short :
Each time you update your API, make the 2 first step. If there is changes, you're client won't compile (if he use an out of date field).