-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Looks like the new Playground doesn't have the --strictBindCallApply compiler option available. It seems suboptimal that we can't do the equivalent of --strict in the Playground (and has caused a few issues when trying to reproduce issues or share code in Stack Overflow that rely on this functionality)
I guess I'm opening this here instead of at microsoft/TypeScript, or at agentcooper/typescript-play, but please tell me if this should be moved. Thanks!
Code
class Class {
prop = "foo";
method() {
return this.prop;
}
}
const instance = new Class();
const boundMethod = instance.method.bind(instance); // any
boundMethod - 7; // no error
const boundMethod2 = instance.method.bind<() => string>(instance); // error
// bind is not generic ---------------> ~~~~~~~~~~~~Expected behavior:
boundMethod should be strongly typed as () => string
Actual behavior:
boundMethod is any
Playground Link:
Playground Link
Related Issues:
https://github.com/orta/typescript-play/issues/11 microsoft/TypeScript#27028: introduction of --strictBindCallApply