Material-Math icon indicating copy to clipboard operation
Material-Math copied to clipboard

🛠️ Refactor: no casting Vue instances as any

Open dlqqq opened this issue 4 years ago • 1 comments

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 🛠️

  • [ ] identify all instances of Vue instances being cast as any to circumvent TS compiler errors
  • [x] add strict checks to tsconfig.json that disable casts to any

dlqqq avatar Oct 28 '20 21:10 dlqqq

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

dlqqq avatar Oct 28 '20 23:10 dlqqq