can't find constructor references of indirectly import
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
i need to find all methods usage in a library ```testLib``` , so i search all modules and classes in ```testLib/index.d.ts``` ,then search all methods usage, everything works fine but the ```constructor``` usage can't be find .
i use a common.ts to wrap testLib's class , if i import class directly from testLib, constructor references works fine .
please help.
my testProject
--Typing
----testLib
------index.d.ts
--index.ts
--common.ts
index.d.ts
```typescript
declare namespace Name1 {
declare namespace Name2{
class MyClassA{
public fun1():void
public constructor() //can't find references
}
}
}
```
common.ts
```typescript
import MyClassA = Name1.Name2.MyClassA
export {MyClassA}
```
index.ts
```typescript
import { MyClassA} from "./common"
let a = new MyClassA()
a.fun1()
```
my morph project is simple ,
```typescript
//setup project
//...
//get sourcefile from 'Typing/testLib/index.d.ts'
let sourceFile:SourceFile = ...
//get MyClass class in sourceFile
let class:ClassDeclaration = ...
//search refs
for (let fun of class.getMethods()) {
let refs = fun.findReferences() // refs length is 1 ,and it's right ,ref by index.ts
}
for (let fun of class.getConstructors()) {
let refs = fun.findReferences() //refs length is 0 ,can't find constructor usage
}
```
Contributor guide
Research direction
Start with the reproduction files Typing/testLib/index.d.ts, common.ts, and index.ts, then compare findReferences() results for getMethods() and getConstructors(). Trace the source file and class declarations used by the morph project. Done means the constructor usage through the re-exported MyClassA is found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100