15. OmitThisParameter<T> を実装する
シェアしよう
- 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