Skip to content

Typescript error with default value for prop #15174

Answered by 7nik
karchung0930 asked this question in Q&A
Discussion options

You must be logged in to vote

That's correct: "" won't be replaced by the default value, and "".at(0) is undefined. And furthermore, TS doesn't care about the text length in the first place.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@karchung0930
Comment options

@7nik
Comment options

@karchung0930
Comment options

Answer selected by karchung0930
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