2016-10-04 63 views

回答

1

它應該是很容易的,你已經安裝了@類型/ gapi.auth2後,只需在您的tsconfig.jsoncompilerOptions部分添加以下行:

"types": ["gapi.auth2"] 

並確保您使用的打字稿2 .x

希望這會有所幫助。

+0

導入後如何在項目中使用它?例如,我是否需要在代碼中再次導入,例如'@ types/gapi.auth2'中的import {GoogleAuth};'? –

+1

是的,你應該像這樣導入它:從'gapi.auth2'導入{GoogleAuth};' – Amid

+0

添加到tsconfig.json後,我嘗試從'gapi.auth2'導入{GoogleAuth},但它有錯誤? –

相關問題