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

children types not preserved #551

Closed
landabaso opened this issue Feb 17, 2017 · 3 comments
Closed

children types not preserved #551

landabaso opened this issue Feb 17, 2017 · 3 comments
Labels
Milestone

Comments

@landabaso
Copy link

Suppose:

render() {
  const i = 0;
  return <Component>{i}</Component>
}

Then in Component typeof this.props.children === 'string'.
In React the type is still a Number.
I can of course parse the result but I guess this is something that has to be fixed?

Thanks for this project!

@developit
Copy link
Member

That's an interesting one. Preact normalizes types, but I guess maybe we should be skipping that normalization for components, instead only applying it to element VNodes.

@landabaso
Copy link
Author

Well, that normalization breaks compatibility I guess...
In my App it throws because I'm already assuming I get a Number.
What is the underlying reason for that normalization?

@developit
Copy link
Member

developit commented Feb 17, 2017

It simplifies the diff and avoids passing too many types through the algorithm in order to keep IC size down. That said, it's only number and string now, booleans are always removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants