Skip to content

"Go to definition" not working with declarationMap and projects references #25662

@OliverJAsh

Description

@OliverJAsh

TypeScript Version: 3.0.0-rc

Search Terms:

Code

Full reproduction case

src
├── client
│   ├── main.ts
│   └── tsconfig.json
└── shared
    ├── main.ts
    └── tsconfig.json
// src/client/main.ts
import { foo } from '../shared/main';

console.log({ foo })
// src/client/tsconfig.json
{
    "compilerOptions": {
        // Needed for project references.
        "composite": true,
        "declaration": true,

        // Other options...
        "outDir": "../../lib/client",
        "strict": true, "module": "esnext", "moduleResolution": "node",
    },
    "references": [
        { "path": "../shared" }
    ]
}
// src/shared/main.ts
export const foo = 1;
// src/shared/tsconfig.json
{
    "compilerOptions": {
        // Needed for project references.
        "composite": true,
        "declaration": true,
        "declarationMap": true,

        // Other options...
        "outDir": "../../lib/shared",
        "strict": true, "module": "esnext", "moduleResolution": "node",
    }
}
  • Run tsc --build ./src/client/
  • Configure VSCode TypeScript version to use workspace, and reload VSCode

Expected behavior:
"Go to definition" should work for foo identifier in src/client/main.ts.

Actual behavior:
"Go to definition" does not work for foo identifier in src/client/main.ts.

image

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions