fixUnusedIdentifiers doesn't work on `js` files
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
Version: 17.0.1
**To Reproduce**
When using `fixUnusedIdentifiers` on source of a js file, this error occurs `Error: Could not find source file`
To reproduce:
```ts
import { Project } from 'ts-morph';
const project = new Project();
project.addSourceFilesAtPaths([`src/**/*.{ts,js}`]);
const sources = project.getSourceFiles();
sources.forEach(sourceFile => {
sourceFile.fixUnusedIdentifiers();
});
```
i also have `src` folder with `file.js`
```ts
// file.js
const test = 'test'
```
When i run this code i get this error:
```
Error: Could not find source file: '.../test/file.js'.
at getValidSourceFile (.../node_modules/@ts-morph/common/dist/typescript.js:169206:29)
....
```
**Expected behavior**
Should fix unused identifiers or at least not fail
Contributor guide
Assessment
This issue has not been assessed yet.