microsoft / microsoft/TypeScript
esmoduleinterop: Improve error message when calling static method on class
Open
Nobody has claimed this yet.
Domain: Error Messages
Help Wanted
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: master
Code
b.d.ts:
declare class C { static m(): void }
declare namespace C {}
export = C;
import * as C from "./b";
C.m();
Expected behavior:
src/a.ts(1,1): error TS7038: A namespace-style import will import a module namespace object, not a class.
src/a.ts(2,3): error TS2339: Property 'm' does not exist on type 'typeof C'.
Actual behavior:
src/a.ts(2,3): error TS2339: Property 'm' does not exist on type 'typeof C'.
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 example using b.d.ts and src/a.ts, starting with the TypeScript compiler's handling of namespace-style imports and static member lookup. Confirm the current diagnostic and compare it with the expected TS7038 and TS2339 messages; done means the additional namespace-object warning appears without losing the existing property error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100