15. OmitThisParameter<T> を実装する

TypeScript

  - accepted / - tried

Function.prototype.bind()を使うと、thisは固定される。 こういうケースのため、OmitThisParameter<T>を使うと良い。

MyOmitThisParameter<T>を実装してみてください。

function foo(this: {a: string}) {}foo() // Errorconst bar = foo.bind({a: 'BFE.dev'})bar() // OKtype Foo = (this: {a: string}) => stringtype Bar = MyOmitThisParameter<Foo> // () => string

5分間以内で解いてみて