TypeScript @types
在閱讀本文之前建議閱讀以下兩篇文章:
(1).TypeScript d.ts檔案一章節。
(2).TypeScript declare一章節。
Typescript 2.0 之後,TypeScript 將會預設檢視node_modules/@types 資料夾。
自動從上述位置獲取模組的型別定義,當然需要獨立安裝這個型別定義。
比如說我要提示jQuery,那麼使用這個命令:
[Shell] 純文字檢視 複製程式碼npm install @types/jquery -save
然後就發現專案裡面多了node_modules/@types/jquery資料夾。
截圖如下:
2.0之前也有幾種管理型別的方式,不過當前不推薦使用。
如果是自定義的d.ts檔案,那麼需要使用三斜線指令在頭部引入(@types方式不需要)。
相關文章
- TypeScript 之 Object TypesTypeScriptObject
- TypeScript 之 Indexed Access TypesTypeScriptIndex
- TypeScript 之 Conditional TypesTypeScript
- 搞懂 TypeScript 中的對映型別(Mapped Types)TypeScript型別APP
- EF Core – Owned Entity Types & Complex Types
- stock Types
- TypeScript 引數簡化實戰(進階知識點conditional types,中高階必會)TypeScript
- Types of Locks (340)
- 譯|There Are No Reference Types in GoGo
- Two Types of Error in JAVAErrorJava
- Understanding Service Types
- Scala的Abstract Types
- Types of SAP Support PackagesPackage
- types of undo segments(ZT)
- Behind RabbitMQ Exchange TypesMQ
- Trusted Types APIRustAPI
- DataTransfer.types 屬性
- birkenstock sandals spec Younger types
- Types of Processes (108)
- 【譯】 Types are moving to the right
- SAP MM Stock Tables and Stock Types
- PostgreSQL DBA(80) - Object Identifier TypesSQLObjectIDE
- Go 迷思之 Named 和 Unnamed TypesGo
- This page provides the following types of documentationIDE
- Scala的Infix Type與Self Types
- Types of Oracle Database Users : Database Users (6)OracleDatabase
- different testing types ( by quqi99 )
- typescriptTypeScript
- TypeScript 簡明教程:認識 TypeScriptTypeScript
- TypeScript 簡明教程:安裝 TypeScriptTypeScript
- 「極速上手TypeScript」TypeScript之PromiseTypeScriptPromise
- RabbitMQ 訊息佇列之 Exchange TypesMQ佇列
- Lerning Entity Framework 6 ------ Complex typesFramework
- [CareerCup] 15.4 Types of Join 各種交
- mysql 5.6 for linux install(three types)MySqlLinux
- Types of Oracle Database Users : Security Officers (2)OracleDatabase
- Types of Oracle Database Users : Application Developers (4)OracleDatabaseAPPDeveloper
- setup types & setup standard operation(BOM>Rountings)