【发布时间】:2022-01-21 19:04:38
【问题描述】:
例如:
/**
* 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) {
}
如您所见,使用了NumberLike,但未使用StringLike 类型,我想在我们的项目中找到所有这些未使用的类型定义。这是一个安装了typescript 的Nodejs 项目。
这是我们的tsconfig.json 文件:
{
"compilerOptions": {
"baseUrl": ".",
"jsx": "react",
"allowJs": true,
"checkJs": true,
"target": "ESNext",
"noEmit": true,
"moduleResolution": "node",
"isolatedModules": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"strictNullChecks": true,
},
}
【问题讨论】:
-
当你说“找到”时,你是什么意思具体/字面意思(详细)?
-
@jsejcksn,仅查看未使用类型的列表对我来说就足够了(所以我可以删除它们)
标签: javascript typescript jsdoc