Microsoft/TypeScript

Report evolving arrays / evolving variables differently in QuickInfo

Open

#54,414 建立於 2023年5月26日

在 GitHub 查看
 (9 留言) (11 反應) (0 負責人)TypeScript (6,726 fork)batch import
Experience EnhancementHelp WantedSuggestion

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

Suggestion

🔍 Search Terms

evolving array any quickinfo tooltip

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

When hovering over an evolving array, we should show the type as something special so that people don't think it's actually any and get mad/confused about it

Proposed Instead of

const arr = [];
arr
// ?^ any[]

show

const arr = [];
arr
// ?^ (evolving array)

Same for

let a;

📃 Motivating Example

We have many reports both external and internal of people thinking that an evolving array is of type any. This also appears as bug reports where people think that noImplicitAny has a bug in it because it's not reporting one

Recently https://twitter.com/mattpocockuk/status/1662103198910300161

#43752 #45369

💻 Use Cases

Prevent confusion

貢獻者指南