- Learn React with TypeScript 3
- Carl Rippon
- 140字
- 2021-06-10 19:16:44
Cross-project Go to Definition
In order for the Go to Definition feature in Visual Studio Code to work across projects, we need to set the declarationMap setting in tsconfig.json.
Let's continue with our multiple project example:
- Let's open person.ts in ProjectA, right-click on the randomString reference, and select Go to Definition:
We are taken to the declaration file rather than the source file:
- We can resolve that by setting declarationMap in tsconfig.json in the Shared project:
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
...
},
}
If we compile the Shared project and try the Go to Definition feature again, we are taken to the source file, as we would want.
So, by setting declarationMap to true in the dependent project, along with composite and declaration, we get great support for multiple TypeScript projects.
推薦閱讀
- Java逍遙游記
- MySQL 8從入門到精通(視頻教學版)
- Java程序員面試算法寶典
- Scratch 3游戲與人工智能編程完全自學教程
- Blender 3D Incredible Machines
- SSM開發(fā)實戰(zhàn)教程(Spring+Spring MVC+MyBatis)
- Shopify Application Development
- 從零開始學Python大數(shù)據(jù)與量化交易
- 程序員面試金典(第6版)
- Python繪圖指南:分形與數(shù)據(jù)可視化(全彩)
- Mastering R for Quantitative Finance
- Learning QGIS(Second Edition)
- 網(wǎng)頁設計理論與實踐
- SQL Server 2005數(shù)據(jù)庫項目教程
- Intelligent Document Capture with Ephesoft(Second Edition)