The comment wasn't for union types. It was an addition to the article from a purely linting perspective. Let's suppose you have a loader and you are using const [loading, setLoading] = useState<boolean>(false), in that case <boolean> is redundant here.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not always true. If you initialise a value to null, TS then only allows null for the field.
Then we need to do this ->
The comment wasn't for union types. It was an addition to the article from a purely linting perspective. Let's suppose you have a loader and you are using
const [loading, setLoading] = useState<boolean>(false), in that case<boolean>is redundant here.