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
And if you use TSUtils.isTypeAssignableToNumber(checker, type) where type comes from the AST and refers to a type like: { toFixed: () => string };, it should return true, but it returns false. This also happens for the type { } which should also return true for any number. Similar issues happens for isTypeAssignableToString.
This TS playground link demonstrates that all of these are assignable to either number or string, but I get the wrong value from isTypeAssignableToNumber/String in all cases:
If you have code like this:
And if you use
TSUtils.isTypeAssignableToNumber(checker, type)
where type comes from the AST and refers to a type like:{ toFixed: () => string };
, it should returntrue
, but it returns false. This also happens for the type{ }
which should also returntrue
for any number. Similar issues happens forisTypeAssignableToString
.This TS playground link demonstrates that all of these are assignable to either number or string, but I get the wrong value from
isTypeAssignableToNumber/String
in all cases:https://www.typescriptlang.org/play?#code/DYUwLgBADgXBDeEwHsBiBLAHiAJnAFAJQQC8AfBAM5gBO6AdgOYDcEAvqRAEwCszAUP1CQAjnEQcSEAMwAWPoOERM4pMgCqUKCBoBhAIaUQBYuSq0GLdpwDkNgUPAQAnqskQbAdwAW+sCAA3HXsgA
I'm using TS 4.7.2 by the way and TSUtils 3.17.1
The text was updated successfully, but these errors were encountered: