Microsoft/TypeScript
在 GitHub 查看Incorrect report of self-referencing type for static fields
Open
#62,552 建立於 2025年10月6日
Domain: check: Type InferenceHelp WantedPossible Improvement
倉庫指標
- Star
- (48,455 star)
- PR 合併指標
- (平均合併 6天 17小時) (30 天內合併 9 個 PR)
描述
🔎 Search Terms
TS7022 implicitly has type 'any'
🕗 Version & Regression Information
- The issue applies to all TypeScript 5 versions and TypeScript 6 nightly
⏯ Playground Link
💻 Code
function id<T>(x: T): T {
return x
}
const Foo = id(class {
static readonly foo = id(42) // Error TS7022
})
const Ok = class {
static readonly foo = id(42) // No error
}
🙁 Actual behavior
Type error TS7022 reported
🙂 Expected behavior
No type error
Additional information about the issue
No response