The Type { toUpperCase: () => string; } | undefined should be assignable the value '', but when I get a type like the aforementioned type using checker.getTypeAtLocation(node) and then use it like isAssignableToValue(type, '') it returns false.
You can clearly see that it should work by just trying it out in the TS playground:
let x: { toUpperCase: () => string; } | undefined = '';
TS has no problem with the above code b/c '' "looks like" a string (since all strings have .toUpperCase() which returns a string.
The Type
{ toUpperCase: () => string; } | undefinedshould be assignable the value'', but when I get a type like the aforementioned type usingchecker.getTypeAtLocation(node)and then use it likeisAssignableToValue(type, '')it returns false.You can clearly see that it should work by just trying it out in the TS playground:
let x: { toUpperCase: () => string; } | undefined = '';TS has no problem with the above code b/c
''"looks like" a string (since all strings have.toUpperCase()which returns a string.