Loading...
function toHex(this: number) {
return this.toString(16);
}
const fiveToHex = toHex as unknown as () => string;function toHex(this: number) {
return this.toString(16);
}
const fiveToHex: OmitThisParameter<typeof toHex> = toHex.bind(5);The cast hides the missing this; bind() supplies it, and OmitThisParameter types the bound result.
this as undefined at runtime.fn.bind(obj).this still fails at runtime.With strictBindCallApply, fn.bind(obj) returns OmitThisParameter<typeof fn>, so the bound function no longer needs this.
OmitThisParameter<T> returns the function type unchanged.