For example:
/**
* A number, or a string containing a number.
* @typedef {(number|string)} NumberLike
*
* Dummy type
* @typedef {(string|null)} StringLike
*/
/**
* Set the magic number.
* @param {NumberLike} x - The magic number.
*/
function setMagicNumber(x) {
}
As you can see NumberLike
is used, but the StringLike
type is not used and I’d like to find all such unused type definitions on our project. It’s a Nodejs project with typescript installed.
Here’s our tsconfig.json
file:
{
"compilerOptions": {
"baseUrl": ".",
"jsx": "react",
"allowJs": true,
"checkJs": true,
"target": "ESNext",
"noEmit": true,
"moduleResolution": "node",
"isolatedModules": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"strictNullChecks": true,
},
}