Closed rogersm closed 3 years ago
I've seen never
used to annotate the fact that the method returns an error but if that's an antipattern we can remove it
That would be my recommendation.
Typescript Deep Dive Book describes the use of never in detail.
Makes sense to me -- let's ditch it, then.
On Mon, May 17, 2021 at 2:57 PM Roger Sen @.***> wrote:
That would be my recommendation.
Typescript Deep Dive Book describes the use of never in detail. https://basarat.gitbook.io/typescript/type-system/never
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Ranvier-TS/core-ts/issues/12#issuecomment-842555637, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6GX6IHE3Y4KQTGOW2PEXTTOFRKBANCNFSM447B7QFA .
Folks,
why are we doing typing the return from Area::getRoomById with never?
Never should be used for:
And in this case we return (room) or we may (but not always) thrown an Error.
Shouldn't this be:
getRoomById(id:string): Room { ... }