Skip to content

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

Description

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

Activity

  1. weswigham commented on Jul 24, 2018

    @weswigham
    Member

    Having looked at the other issue, I think this is a dupe of #25792 - or rather, #25792 is a dupe of this, but I looked into #25792 first. 😛 In any case, I should have a fix promptly.

  2. OliverJAsh commented on Aug 1, 2018

    @OliverJAsh
    ContributorAuthor

    Wesley Wigham (@weswigham) I just tested this with 3.0.1 and I can still reproduce. Any ideas? Can we re-open?

  3. mhegazy commented on Aug 2, 2018

    @mhegazy
    Contributor

    Wesley Wigham (@weswigham) can you take a look.

  4. AnyhowStep commented on Aug 8, 2018

    @AnyhowStep
    Contributor

    On 3.0.1, have this issue, too.

    Code checks, compiles, runs, etc. just "Go to definition" not working.

  5. OliverJAsh commented on Aug 11, 2018

    @OliverJAsh
    ContributorAuthor

    Can we re-open this issue whilst it is investigated again?

  6. Soul-Master commented on Aug 14, 2018

    @Soul-Master

    I just tried declarationMap option in TypeScript 3.0.1. But it doesn't work both in VS 2017 15.8.0 Preview 5.0/VS Code 1.26.0

    https://github.com/Soul-Master/typescript3-composite-project/tree/declarationMap

    In VS Code 1.26.0

    image

    image

    In VS 2017 15.8.0 Preview 5.0

    image

    image

  7. OliverJAsh commented on Sep 25, 2018

    @OliverJAsh
    ContributorAuthor
  8. OliverJAsh commented on Oct 10, 2018

    @OliverJAsh
    ContributorAuthor

    Please can we re-open this issue? /cc Wesley Wigham (@weswigham) Mohamed Hegazy (@mhegazy)

    (Sorry to pester here but I think this needs attention, as it's a very basic use case.)

  9. added
    Needs InvestigationThis issue needs a team member to investigate its status.
    and removed
    FixedA PR has been merged for this issue
    on Oct 11, 2018
  10. sgronblo commented on Jan 25, 2019

    @sgronblo

    Is there any way to help figuring this out. I have declarationMap working in a small toy project that I created to learn about how to setup a monorepo with project references.

    However, in our actual project repo when I use "Go To Definition" I get sent to the FILENAME.d.ts file of the referenced project. Even though I have a FILENAME.d.ts.map right next to it.

    I tried setting TypeScript > TsServer:Log to verbose. And then tail the log file when I go to the definition. But nothing interesting shows up in the log file. I can't figure out if TS thought it wasn't supposed to look for a map file, if it looked but couldn't find, or if it found something but it wasn't valid.

  11. weswigham commented on Mar 14, 2019

    @weswigham
    Member

    Oliver Joseph Ash (@OliverJAsh) your repro seems to be fixed in the latest versions of TS (I'm pretty sure we've had a continuous stream of improvements to this area since 3.0).

  12. OliverJAsh commented on Mar 14, 2019

    @OliverJAsh
    ContributorAuthor

    Just tested, it works! Thanks 🎉

  13. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions