-
Notifications
You must be signed in to change notification settings - Fork 134
Use TypeScript to 'compile' our JS snippets #95
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
Conversation
|
@abeisgoat @jhuleatt @jamesdaniels would love to know your thoughts on this method. |
|
One way to resolve TS errors is to annotate types with comments in the JS files. Might help with the |
|
@jhuleatt you're OOO get outta here! But thank you. |
|
This now fails for the right reasons: |
| admin.auth().getUser(uid).then((userRecord) => { | ||
| // The claims can be accessed on the user record. | ||
| console.log(userRecord.customClaims.admin); | ||
| console.log(userRecord.customClaims['admin']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this switched from customClaims.admin to customClaims['admin'] here and below to make the compiler happy? I think the original .admin syntax is nicer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it was ... do you have a suggestion for how we can have the . syntax? I actually don't mind this because it shows a division between types parts userRecord.customClaims and the any Danger Zone
Right now it's easy to write snippets in this repo which won't actually work, which somewhat defeats the point.
We can use TypeScript to get much better checking on our JS snippets because many of our deps (like
firebase-admin) ship with types.This helped me find a bunch of useful errors in the
authmodule, although I am stuck on a few.Valid remaining errors (our stuff is actually broken):
Invalid remaining errors (I need help with these):