Open
Description
When calling bind
on a function Javascript does not copy the properties across that have been added to that function, however TS treats them as having been copied.
TypeScript Version: 3.7-Beta
Search Terms: function bind
Code
const a = () => { }
a.hello = 'hi'
const b = a.bind({})
b.hello.split("") // Uncaught TypeError: Cannot read property 'split' of undefined
Expected behavior: hello
field should not be present on typeof b
.
Actual behavior: hello
is deemed to exist on typeof b
and the program crashes.
Related Issues: #212 seems to be where this was discussed and finally implemented, although it's not directly related.