Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhancement: makeTypeOrValueSpecifier follow aliases chain (add support for re-exports) #10053

Open
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or request
@auvred

Description

@auvred

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

type-utils

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Currently,typeMatchesSpecifier/typeMatchesSomeSpecifier work only with type.
Internally,typeMatchesSpecifier tries to get symbol of the given type.
The returned symbol is the original symbol (the symbol alias chain is bypassed).

Imagine that the user wants to allow usingAliasedType fromlib-bar -{ from: 'package', name: 'AliasedType', package: 'lib-bar' }.
ButAliasedType is just a re-exportedMyType from thelib-foo package.
CallinggetTypeAtLocation in user'sfile.ts will return theMyType type that is declared inlib-foo.

// lib-foo/index.d.tsexporttypeMyType=1// lib-bar/index.d.tsexporttype{MyTypeasAliasedType}from'lib-foo'// file.tsimporttype{AliasedType}from'lib-bar'typeTest=AliasedType//           ^ its type is `MyType`, so we've lost AliasedType symbol here

Proposal: let's maketypeMatchesSpecifier accept a symbol instead of type.
That way, we can go through the alias chain and support pointing to re-exported types.

Additional Info

Related to#9608:

...which means our existing "what single module name is this exported under?" logic might need to be expanded to also support re-exports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp