supertokens-auth-react
supertokens-auth-react copied to clipboard
Refactor SDK types to avoid using `any` as much as possible
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