0
최근 지원되지 않는 NuGet 패키지를 대체하기 위해 NPM 입력을 사용하도록 업그레이드되었습니다. 제대로 작동하는 데 사용되는 다음 코드속성 x가 유형에 없습니다. 기능
interface Function
{
/** Creates a function that calls the specified function using the specified "this" pointer. Useful in scenarios where we need to pass a function as a callback, but specifying the value of "this".*/
defer(thisArg: Object): Function;
}
Function.prototype.defer = function (thisArg: Object)
{
var self = this;
//return a function that calls the current function with the specific this argument
return function()
{
self.call(thisArg)
};
}
하지만 지금은 오류가 나는 인터페이스를 지정하고 있습니다 때문에 속성이 존재 않습니다 Property 'defer' does not exist on type 'Function'.
받고 있어요,하지만 컴파일러 여전히 불평하고있다. 이 문제를 어떻게 해결할 수 있습니까?
하지 대답,하지만이없는 것 ['bind'] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind) 그렇지? –
javascript 출력을보고'defer' 함수를 사용하는 코드가 정의 이후에 * 출력되고 있는지 확인하십시오. 파일이 잘못된 순서로 출력되면 정의가 사용되기 전에 사용되며 오류가 발생합니다. –