- 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.
推薦閱讀
- 少兒人工智能趣味入門:Scratch 3.0動(dòng)畫與游戲編程
- 深入核心的敏捷開發(fā):ThoughtWorks五大關(guān)鍵實(shí)踐
- Python編程自學(xué)手冊(cè)
- Redis Applied Design Patterns
- Visual FoxPro程序設(shè)計(jì)教程(第3版)
- Vue.js快速入門與深入實(shí)戰(zhàn)
- Access 2010數(shù)據(jù)庫基礎(chǔ)與應(yīng)用項(xiàng)目式教程(第3版)
- GameMaker Programming By Example
- 3D少兒游戲編程(原書第2版)
- HDInsight Essentials(Second Edition)
- SQL經(jīng)典實(shí)例(第2版)
- 蘋果的產(chǎn)品設(shè)計(jì)之道:創(chuàng)建優(yōu)秀產(chǎn)品、服務(wù)和用戶體驗(yàn)的七個(gè)原則
- NetBeans IDE 8 Cookbook
- HoloLens與混合現(xiàn)實(shí)開發(fā)
- Visual Basic程序設(shè)計(jì)(第三版)