Strict typing helps catch errors early during development, provides better autocompletion and documentation, and makes the code more predictable and easier to refactor.
🤝 We must be strong 💪
Use TypeScript and then set everything to type Any
- JavaScript User47
Example
❌ Wrong ❌
This code is not compatible* with supabase SDK as fullName is not a field belonging to the data structure passed into signUp()
const data = {
email: formData.get("email") as string,
password: formData.get("password") as string,
fullName: formData.get("full-name") as string,
};
🟢 Good 🟢
This code directly follows the SDK and would throw an error if fullName was added tot he root of data
const data: SignUpWithPasswordCredentials = {
email: formData.get("email") as string,
password: formData.get("password") as string,
options: {
data: {
full_name: formData.get("full-name") as string,
},
}
};
Strict typing helps catch errors early during development, provides better autocompletion and documentation, and makes the code more predictable and easier to refactor.
🤝 We must be strong 💪
Example
❌ Wrong ❌
This code is not compatible* with supabase SDK as
fullName
is not a field belonging to the data structure passed intosignUp()
🟢 Good 🟢
This code directly follows the SDK and would throw an error if
fullName
was added tot he root ofdata