Am using mirage.js to mock an API that's not complete using typescript in strict mode. I am having trouble with the schema type in the routes() method.
It works, I just want to avoid the warning that comes with using any as the type.
A simple "endpoint" in the routes method
routes () {
this.get(`todos`, (schema: any) => {
return schema.todos.all();
});
}
I also tried to de structure the schema and getting the todos like so:
routes () {
this.get(`todos`, ({ todos }) => {
return todos.all();
});
}
But I didn't managed to find the type the todos should have.
Is there any solution to this issue other than using any?
Edit
A working codesandbox here: https://codesandbox.io/s/vue-5-typescript-forked-57h03m?file=/src/App.vue
Check folder named miragejs to see a more complete version of my code.
This is due to your typescript linter's configuration. You might remove the rule "typedef: arrow-parameter" in your
tslint.jsonRules are explicitly declared, if you want to keep other benefits from the typedef rule, you will have to list them all, here's the one I personnaly use :
Here's the link to the documentation of typedef rule