pzavolinsky / ts-unused-exports

ts-unused-exports finds unused exported symbols in your Typescript project
MIT License
749 stars 49 forks source link

Default Export Incorrectly Marked As Not Used #130

Closed supermacro closed 4 years ago

supermacro commented 4 years ago

I ran ts-unused-exports ./tsconfig.json and got a "false positive" for a default export (i.e. the default export is in fact being used).

My tsconfig.json:

{
  "compilerOptions": {
      "module": "CommonJS",
      "noImplicitAny": true,
      "sourceMap": false,
      "downlevelIteration": true,
      "noUnusedLocals": true,
      "noUnusedParameters": true,
      "strictNullChecks": true,
      "baseUrl": "./src",
      "lib": [
        "dom",
        "es2016",
        "es2017.object"
      ],
      "outDir": "build"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
      "node_modules",
      "**/*.spec.ts"
  ]
}

The file with the default export


import { Admin } from 'prisma-client'

type CUID = Admin['id']

const sessionMap = new Map<CUID, {}>()

export default sessionMap
supermacro commented 4 years ago

I immediately saw that I had 2 duplicated files! My bad 🙈