Skip to content

addUnknownSymbolResolver to expose more than name #1832

@jpoehnelt

Description

@jpoehnelt

Problem

addUnknownSymbolResolver accepts a resolver that receives ts.Symbol.name, however the name is insufficient to identify the symbol in cases where the symbol is namespaced such as the following:

declare namespace foo.bar {
  class Baz {}
}

in the resolver this is only identified as Baz and not foo.bar.Baz

Suggested Solution

1. allow the resolver to access ts.Symbol

app.renderer.addUnknownSymbolResolver("my-package", (symbol: Symbol) => {
  // get namespace from Symbol.parent
   return '';
 });

This would be a breaking change and may expose a more complex interface than needed(?).

2. pass the namespaced name joining ts.Symbol.parent resulting in foo.bar.Baz.

This option would not be a breaking change and is sufficient for my use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions