You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have no strong opinion on this. Just a thought, though, it might be worth explaining why it would become floating in that case. What about including in the message something like the phrase The Promise constructor treats a nullish rejection handler the same as an omitted one.?
I would imagine though anyone reading it will make the connection with or without the hint, though.
Not just nullish handlers; but anything non-callable.
Good point... I hadn't thought to check since the TS declarations only allow null | undefined | () => PromiseLike<T>. Is the convention in the Typescrpt-Eslint codebase to acknowledge all JS possibilities even if they're a TS error?
Maybe "If the rejection handler is not a function, it will be ignored." or "If the rejection handler is not a function, it will be treated the same as if it were omitted." would be more general?
acknowledge all JS possibilities even if they're a TS error?
I don't think we need to - TS giving an error is enough for users. No need for us to add an addition scream-in-your-face on top of it. It is nifty to know that JS natively ignores non-callable things though.
I think "If the rejection handler is not a function, it will be ignored." is much better than "if it is nullish". The latter is technically not wrong (because it's a sufficient condition), but it doesn't give the full information. The former is also not too complex.
…en with second argument undefined (#6881)
* fix(eslint-plugin): [no-floating-promises] False negative calling .then with second argument undefined (Issue #6850)
* use getTypeAtLocation correctly
* clean up duplicate
* correct mistake in IIFE abbreviation
* purge the word invocated from the codebase