다음 TypeScript 코드에서 오류가 발생합니다.
///<reference path='../../../Shared/typescript/jquery.d.ts' />
///<reference path='../../../Shared/typescript/jqueryStatic.d.ts' />
function accessControls(action: Action) {
$('#logoutLink')
.click(function () {
var $link = $(this);
window.location = $link.attr('data-href');
});
}
다음에 대해 밑줄이 그어진 빨간색 오류가 발생합니다.
$link.attr('data-href');
메시지 내용 :
Cannot convert 'string' to 'Location': Type 'String' is missing property 'reload' from type 'Location'
이것이 무엇을 의미하는지 아는 사람이 있습니까?
window.location = "some string"에는 특별한 동작이 있습니다. 여기를 참조하십시오. stackoverflow.com/questions/2383401/…- 동일 사이트, 동일 출처 및 XHR 동작에 대한 주석을 참조하십시오.