Closed testerez closed 5 years ago
Hi @testerez , it should support TSX no problem.
Below's a working example.
Double check the tsconfig.json
and it you've found an unsupported case, please include a minimal example that doesn't work.
Cheers!
Here's the example:
package.json
{
"dependencies": {
"@types/react": "^16.4.18",
"react": "^16.6.0",
"ts-unused-exports": "^2.0.11"
}
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"outDir": "./dist",
"jsx": "react"
},
"include": [
"./src/**/*.ts",
"./src/**/*.tsx"
]
}
src/comp.tsx
import * as React from 'react';
import { thisOneIsUsed } from './util';
const Comp = ({ a }:{ a: string }) => <div>{thisOneIsUsed}{a}</div>;
console.log(Comp);
src/util.ts
export const thisOneIsUsed = 1;
export const thisOneIsNot = 2;
$ npm i
$ ./node_modules/.bin/ts-unused-exports tsconfig.json
1 module with unused exports
src/util: thisOneIsNot
Thanks @pzavolinsky I'll give it a deeper try when I find time for it.
Closing - we can add some example cases to match.
I quickly tried this on a projet but most detected unused exports were actually used in tsx files. Is it a known limitation?