microsoft / microsoft/TypeScript
Internal error in tsc: "TypeError: Cannot read properties of undefined (reading 'flags')"
@sandersn 已经在做这个了。
开始于 2025年4月16日。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
### 🔎 Search Terms
TypeError: Cannot read properties of undefined (reading 'flags')
### 🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about unhandled TypeScript errors
### ⏯ Repository Link
https://github.com/GaurangTandon/tsc-issue-repro
### 💻 Code
```ts
const UPDATE_MARKER_FUNC = 'updateMarkerPosition';
window[UPDATE_MARKER_FUNC] = (coordinates, color = 'red') => {};
```
### 🙁 Actual behavior
```text
/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:122142
throw e;
^
TypeError: Cannot read properties of undefined (reading 'flags')
at getMembersOfSymbol (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:56777:19)
at getLateBoundSymbol (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:56787:11)
at getSymbolOfDeclaration (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:49588:43)
at getSymbolOfNode (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:49591:34)
at getFunctionExpressionParentSymbolOrSymbol (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:49598:198)
at getResolvedMembersOrExportsOfSymbol (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:56742:27)
at getExportsOfSymbol (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:49486:61)
at resolveAnonymousTypeMembers (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:57350:19)
at resolveStructuredTypeMembers (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:57698:11)
at getSignaturesOfStructuredType (/Users/blazegt/test-tsc/node_modules/typescript/lib/_tsc.js:58389:24)
Node.js v20.18.3
```
### 🙂 Expected behavior
Internal TypeScript errors should not be thrown.
### Additional information about the issue
_No response_
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。