Skip to content

Typing question with createSignal() #215

Answered by voliva
hoclun-rigsep asked this question in Q&A
Discussion options

You must be logged in to vote

Yes... Well, it's just the way that's easier to use IMO.

  • The first case createSignal() is sugar for createSignal(() => {}) - Just faster to type
  • The second case createSignal<number>() is sugar for createSignal((payload: number) => payload) - Again, less characters

It's not like they should put parameters explicitly, is that if they do, it will be easier to type and read IMO. It was designed like this to make it easier.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by josepot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #211 on June 24, 2021 20:59.