I'm looking at enabling the lint rule @typescript-eslint/no-invalid-void-type
. I want to make sure everything it's flagging is truly something I always want to get rid of. Just to check my understanding. Are the following statements correct?
- There's never any reason to include
void
in a type union, likestring | void
. - There's never any reason to declare a function that takes
void
as a param. (Except for something likethis: void
). - There's never any reason to put
void
in a container generic, likeArray<void | string>
. - Putting
void | undefined
on a function return signature (e.g.() => void | undefined
) is redundant. - If you have
() => SomeType | void
, you should use() => SomeType | undefined
instead.
And the reason for most of those statements being true is that you can't instantiate a value of type void, so something like Array<string | void> makes no sense. Right?