Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add strict typing #23

Open
ItWasEnder opened this issue Jun 7, 2024 · 1 comment
Open

Add strict typing #23

ItWasEnder opened this issue Jun 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ItWasEnder
Copy link

ItWasEnder commented Jun 7, 2024

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,
    },
  }
};
@Dmedina20
Copy link

Can we close this? @nang-dev @Fryingpannn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

No branches or pull requests

3 participants