microsoft / microsoft/TypeScript
Don't include full paths in module names in error messages
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.4k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 117
描述
TypeScript Version: 4.0.5 (also tested with typescript@next)
Search Terms: namespace has no exported member error
Description
Currently certain error messages shows full file paths. For example:
Namespace '"y:/projects/opf/portal/OPF.Portal.Web/Content/Scripts/DinSide/App/Store/index"' has no exported member 'All'. ts(2694)
Could not find a declaration file for module 'shortid'. 'y:/projects/opf/portal/OPF.Portal.Web/node_modules/shortid/index.js' implicitly has an 'any' type.
Trynpm install @types/shortidif it exists or add a new declaration (.d.ts) file containingdeclare module 'shortid';ts(7016)
Our project was started without strict: true (and few @typescript-eslint rules), so the code base includes several thousand errors. To be able to gradually fix them, we have started to use betterer, which includes committing a snapshot of all the current errors. Snapshot is then used to report report when we fix errors, and fail our build if we add new errors. But because of certain Typescript errors using full file paths, we're getting unnecessary diffs in this snapshot.
Would it be possible to use file paths relative to the project/tsconfig.json root in the error messages instead?
So, with tsconfig.json in y:/projects/opf/portal/OPF.Portal.Web/, the error message would instead be:
Namespace '"Content/Scripts/DinSide/App/Store/index"' has no exported member 'All'. ts(2694)
An alternative solution could be to change betterer instead, make it auto-replace file paths with relative paths, or something like that. But figured I could at least ask here, especially since it could maybe be an issue for other tools as well.
Related Issues: Couldn't find any
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用示例和一个 tsconfig.json 根目录重现诊断代码 2694 和 7016,然后追踪模块名称和声明文件路径在哪里进行格式化。完成标准是这些消息使用相对于项目根目录的路径,同时不破坏现有诊断或建议的 npm 声明文本。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100