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

TypeScript: Strongly typed intrinsic elements #60

Open
brainkim opened this issue Apr 24, 2020 · 1 comment
Open

TypeScript: Strongly typed intrinsic elements #60

brainkim opened this issue Apr 24, 2020 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@brainkim
Copy link
Member

brainkim commented Apr 24, 2020

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.

@brainkim brainkim changed the title Strongly typed intrinsic elements TypeScript: Strongly typed intrinsic elements Apr 25, 2020
@wmadden
Copy link

wmadden commented Apr 28, 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.)

@brainkim brainkim added help wanted Extra attention is needed good first issue Good for newcomers labels Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants