在 js 中,我使用以下代碼function m() { console.log(this)}m()這返回當前上下文但是在 ts 中,我使用下面的代碼,這個返回 undefinefunction m() { // @ts-ignore console.log(this)}m()我希望在打字稿中使用這個獲取當前上下文,怎么辦?
如何以與在 Javascript 中相同的方式在 Typescript 中訪問“this”?
絕地無雙
2023-03-10 15:58:32