meteor / react-packages

Meteor packages for a great React developer experience
http://guide.meteor.com/react.html
Other
573 stars 158 forks source link

Include false in Typescript factory return definition #303

Closed rijk closed 3 years ago

rijk commented 4 years ago

May I suggest we add false as well? It already works (the code does a falsy check), and in some cases it allows for cleaner code — up to the user's preference of course:

useSubscription(() => boardId && Meteor.subscribe('board', boardId), [boardId])

You don't have to use it like this, but as the code allows it I see no reason for Typescript to give a warning. Hope you'll consider. Thanks!

rijk commented 4 years ago

Rebased on your latest push.

CaptainN commented 4 years ago

I'm not apposed to this, but maybe null instead? In Typescript null makes more sense, and of course, any "falsy" value will work just fine in JS. This is a great addition.

CaptainN commented 3 years ago

I think this has been superseded by other decisions.