Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
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.