Skip to content

Playground missing strictBindCallApply #12

Closed
@orta

Description

@orta

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    PlaygroundIssues that affect the Playground

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions