Skip to content

Impossible to differentiate between two unknown symbols exported with the same name from different locations in the same dep #2125

@achingbrain

Description

@achingbrain

Search terms

  • unknown symbol resolver
  • duplicate symbol names

Question

If I have a dependency called my-dep with two files like:

// src/export-1.ts
export interface DuplicateInterfaceName {}
// src/export-2.ts
export interface DuplicateInterfaceName {}

...and I consume it from my project as:

import { DuplicateInterfaceName } from 'my-dep/src/export-1.js'
import { DuplicateInterfaceName as DuplicateInterfaceName2 } from 'my-dep/src/export-2.js'

export interface ExtendsBoth extends DuplicateInterfaceName, DuplicateInterfaceName2 {

}

I configure an unknown symbol resolver plugin like:

// my-plugin.ts
export function load (app: Application) {
  app.converter.addUnknownSymbolResolver((ref) => {
    console.info(JSON.stringify(ref, null, 2))
  }
}

I get:

{
  "resolutionStart": "global",
  "moduleSource": "my-dep",
  "symbolReference": {
    "path": [
      {
        "path": "DuplicateInterfaceName",
        "navigation": "."
      }
    ]
  }
}
{
  "resolutionStart": "global",
  "moduleSource": "my-dep",
  "symbolReference": {
    "path": [
      {
        "path": "DuplicateInterfaceName",
        "navigation": "."
      }
    ]
  }
}

That is, DuplicateInterfaceName is reported as unknown twice (as expected) but there's no way to differentiate between them.

Is there any way to have more in the ref, perhaps the name of the file in my-dep that the export resolved to?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions