-
-
Notifications
You must be signed in to change notification settings - Fork 185
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 section on JavaScript interop for custom types #272
Conversation
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.
Nice! Do you think we should also show them being imported?
book-src/tour/custom-types.md
Outdated
// JavaScript | ||
new Guest(); // => {} | ||
new LoggedIn("Kim"); // => { 0: "Kim" } | ||
new Animal("Jinx", 2002); // => { name: "Jinx", cuteness: 2002 } |
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.
Could you remove these comments? They're not accurate, and I think the constructors on the left are clear enough.
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, I was trying to find a way to explain how to access named and unnamed properties. Maybe we could do something like
const user = new LoggedIn("Kim");
user[0] === "Kim";
const cat = new Cat("Jinx", 2002);
cat.cuteness === 2002;
Not sure if that's overkill
That's a good idea actually |
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.
Wonderful! Thank you
For #200.
Does something like this look reasonable?