grey-software / Material-Math

Practice Math problems in a fun, beautiful, material experience!
https://material-math.grey.software
MIT License
19 stars 7 forks source link

🛠️ Refactor: no casting Vue instances as any #80

Open dlqqq opened 3 years ago

dlqqq commented 3 years ago

Motivation 🏁

It's bad practice to cast types as any just to circumvent TS compiler errors; that kind of defeats the purpose of type-checking if we disable its functionality every time we run into a problem. i read this article here:

https://v3.vuejs.org/guide/typescript-support.html#using-with-options-api

which talks about how the TS compiler has difficulty inferring types in the Vue framework. Explicitly specifying them with an interface is the preferred method of resolution.

Originally posted by @diracs-delta in https://github.com/grey-software/Material-Math/pull/79#issuecomment-718180597

Describe your refactoring solution 🛠️

dlqqq commented 3 years ago

TS doesn't actually having a compiler option disabling explicit casts to any. we'll just have to wait until we implement ESlint

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md