BugDomain: check: Type CircularityHelp Wanted
倉庫指標
- Star
- (48,455 star)
- PR 合併指標
- (平均合併 6天 17小時) (30 天內合併 9 個 PR)
描述
Bug Report
🔎 Search Terms
implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.(7022)
🕗 Version & Regression Information
This changed between versions 4.6.2 and 4.7.0-beta
⏯ Playground Link
Playground link with relevant code
💻 Code
type Wrapper = {
data: number | null;
};
function example(wrapper: Wrapper) {
// The error goes away if this line is removed and `null` is removed from the type
if (wrapper.data === null) return;
// The error goes away if the loop body is inlined o_O
for (const _ of []) {
const d = wrapper.data;
// ^ 'd' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
// The error goes away without these lines o_O
const t = d;
const list = [0];
if (list[t]) {}
}
}
🙁 Actual behavior
Error: implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer
🙂 Expected behavior
No error