Function shapes with union typed params incorrectly accept more restrictive functions #9765
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Fixed
A PR has been merged for this issue
TypeScript Version: 2.0.0 beta
Functions typed to accept union typed params incorrectly typecheck against functions whose params only match a subset of the union. Example:
Expected
one
throws a type error, sincestring | number
is not assignable tostring
.Actual
one
compiles fine.This comes up in real code when declaring a callback whose params may not be defined, e.g.
The text was updated successfully, but these errors were encountered: