Skip to content

Commit

Permalink
Remove a no longer necessary workaround for a TypeScript bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed Oct 9, 2024
1 parent 2a3ea43 commit 8787d61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Enabled the TypeScript compiler options `noUnusedLocals` and `noUnusedParameters`.
- Use the correct type for the ESLint config.
- Moved JSDoc comments containing `@import` to before real imports.
- Removed a workaround for the fixed TypeScript bug [microsoft/TypeScript#50286](https://github.com/microsoft/TypeScript/issues/50286) in the function `findUnusedExports`.

## 7.0.0

Expand Down
16 changes: 6 additions & 10 deletions findUnusedExports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,12 @@ import scanModuleCode from "./scanModuleCode.mjs";
* [moduleFilePath: string]: ModuleExports,
* }>} Map of module file paths and unused module exports.
*/
export default async function findUnusedExports(options = {}) {
// Avoid function parameter destructuring to workaround this TypeScript bug:
// https://github.com/microsoft/TypeScript/issues/50286
const {
cwd = process.cwd(),
moduleGlob = MODULE_GLOB,
resolveFileExtensions,
resolveIndexFiles = false,
} = options;

export default async function findUnusedExports({
cwd = process.cwd(),
moduleGlob = MODULE_GLOB,
resolveFileExtensions,
resolveIndexFiles = false,
} = {}) {
if (typeof cwd !== "string")
throw new TypeError("Option `cwd` must be a string.");

Expand Down

0 comments on commit 8787d61

Please sign in to comment.