Yaroglek
Yaroglek
实现call/apply方法还是有一些不足的。给context添加额外属性会造成调用方法时,如果涉及到例如`console.log(this)`操作会输出额外属性。我查到的方法是将函数转换成字符串, 并将其中的`this`替换为`context`,然后使用`eval`方法转换成新函数。但是这样又涉及到使用正则判断`this`串是否为变量`this`,以及闭包外层变量被引用或context与闭包内变量重名问题。较难实现。 另外`Function.prototype.call`的参数1,若为空,`null`,`undefined`,则绑定上下文至`Window`。若为基本类型例如1,则绑定至`new Number(1)`,这里的context赋值我是用 ```javascript context = arguments[0] instanceof Object ? arguments[0] : new arguments[0].__proto__.constructor(arguments[0]); ``` 来实现的。
你好, ```typescript type A = { a: string } type B = { readonly a: string } type C = Equal1 // true type D = Equal2 // false ```...
@niklasvh hi, please merge this pr thankyou