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

(fix) generic support for component getter and accessor #1689

Merged
merged 7 commits into from Oct 21, 2022

Conversation

jasonlyu123
Copy link
Member

@dummdidumm
Copy link
Member

Do you know why we don't transform getters by doing get foo() { return this.$$prop_def.foo }? This should work the same for components with and without generics.

@jasonlyu123
Copy link
Member Author

jasonlyu123 commented Oct 18, 2022

I think it's because it wasn't a part of the props back then and we made it props later.

@dummdidumm
Copy link
Member

Mhm, maybe (I thought $$prop_def always existed, but my memory might be tricking me 😅 ). Either way, if there's nothing speaking against it, I'd say it's probably better to transform it that way now, which would make special code for the generic case unnecessary. What do you think?

@jasonlyu123
Copy link
Member Author

It was originally not in the props returned in the render. And there's a separate getter. Then we also add the getters into props. If we change to directly use $$prop_def. Do we still need to keep the getters?

@dummdidumm
Copy link
Member

mhhm I think we can probably remove getters from the transpiled output then. We can't remove this.getters from ExportedNames though because that's used to distinguish between props that are writeable (export let ..) and those that are only readable (export const/function ..)

@dummdidumm
Copy link
Member

Nice one! Is this ready to merge?

@jasonlyu123
Copy link
Member Author

It's ready. Any other thing you want to change?

@dummdidumm dummdidumm merged commit 07c2ab8 into sveltejs:master Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants