You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If people are going to use onevent props we should probably have them typed to prevent no implicit any errors. Maybe we can take the typings from Preact or something similar? My one concern is that intrinsic elements are already sorta loosely typed (data-attrs can be of type any), and I don’t really see the value of typing intrinsic props as this seems like a lot of work to maintain and it’s immediately obvious in the course of development if you’ve messed up. I dunno. We need DOM 0 event props to have their arguments inferred but more than that I think there isn’t much benefit.
The text was updated successfully, but these errors were encountered:
brainkim
changed the title
Strongly typed intrinsic elements
TypeScript: Strongly typed intrinsic elements
Apr 25, 2020
There's now discussion on a few separate issues about what things are worth typing and which end-user scenarios should be covered by typing or not. It'd be great to have a single, clear written description of what the Crank API goals are, what motivations to consider for strict typing etc - a manifesto or something similar.
Some goals are clear: use JavaScript language features instead of building framework solutions, and don't copy existing frameworks' design decisions just out of familiarity. What motivates API design decisions beyond that?
E.g. regarding types I think it's important to strongly type the onevent props, since it's the base that people will build everything else on. More generally, I think whenever a user is writing JSX, props for the components they're using should be strongly typed, and the inputs and outputs of their component functions should be strongly typed.
I'm sure not everyone will agree with me, but it'd be good to have a clear direction in one place to reference for these discussions. And for deciding whether something is a bug or intended behavior (as in #68 e.g.)
If people are going to use
onevent
props we should probably have them typed to preventno implicit any
errors. Maybe we can take the typings from Preact or something similar? My one concern is that intrinsic elements are already sorta loosely typed (data-attrs
can be of typeany
), and I don’t really see the value of typing intrinsic props as this seems like a lot of work to maintain and it’s immediately obvious in the course of development if you’ve messed up. I dunno. We need DOM 0 event props to have their arguments inferred but more than that I think there isn’t much benefit.The text was updated successfully, but these errors were encountered: