- 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.
推薦閱讀
- FuelPHP Application Development Blueprints
- 21天學(xué)通C++(第6版)
- PLC編程及應(yīng)用實戰(zhàn)
- Apache Mesos Essentials
- Python時間序列預(yù)測
- Nginx實戰(zhàn):基于Lua語言的配置、開發(fā)與架構(gòu)詳解
- HTML5從入門到精通 (第2版)
- C語言程序設(shè)計實驗指導(dǎo) (第2版)
- Principles of Strategic Data Science
- Visual Basic程序設(shè)計(第三版)
- Python數(shù)據(jù)可視化之美:專業(yè)圖表繪制指南(全彩)
- Vue.js 3應(yīng)用開發(fā)與核心源碼解析
- 工業(yè)機器人離線編程
- H5+移動營銷設(shè)計寶典
- Web前端開發(fā)最佳實踐