microsoft / microsoft/TypeScript
Inconsistent behavior of "export as" symbols.
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.4.0-dev.20190305
Search Terms: export alias
Code
This is file of some-lib:
export { LongNameOfInnerClass as PublicNameClass } from './long-name-of-inner-class';
This is other file, that import above lib:
import { PublicNameClass } from 'some-lib';
new PublicNameClass(); // Here hints is OK
new PublicNameClass(wrongArgument); // Error ref to LongNameOfInnerClass
Expected behavior:
TypeScript hints have same "export as" aliases for working code and for errors.
Actual behavior:
TypeScript hints for the working code are different from the hints for errors.
Related Issues:
Not sure, but it seems that this issue has a similar problem: symbolToName does handle exports of namespaces
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the two TypeScript snippets in the report using the stated TypeScript version. Trace how the exported alias is resolved for normal completion versus the constructor argument diagnostic, then add or locate coverage for both paths. Done means both hints consistently use PublicNameClass rather than LongNameOfInnerClass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100