supertokens-auth-react icon indicating copy to clipboard operation
supertokens-auth-react copied to clipboard

Refactor SDK types to avoid using `any` as much as possible

Open nkshah2 opened this issue 3 years ago • 0 comments

Problem Statement

The SDK in several places uses any when adding explicit types to variables. While this fixes typescript error this introduces several other problems:

  • Bad dev experience because of the lack of auto complete
  • Harder to debug bugs in code flow
  • Built in types (NodeJS, DOM etc) no longer warn about typing

For example for the Passwordless recipe we use String.substr to get the URL hash but the method has been deprecated. Typescript does not warn about this deprecation because the window object is marked as any in getWindowOrThrowError

Solution

Revisit the types of the SDK (one recipe at a time) and remove as many occurrences of any as possible

nkshah2 avatar Mar 24 '22 06:03 nkshah2