Microsoft/TypeScript

Definite assignment assertion in JS not flagged

開放

#48,446 建立於 2022年3月27日

 (2 則留言) (0 個反應) (0 位負責人)TypeScript (13,395 個分叉)batch import
BugDomain: JavaScriptHelp Wanted

倉庫指標

星標
 (108,860 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Bug Report

Noted by someone on Discord.

🔎 Search Terms

non null assertion javascript error

Related https://github.com/microsoft/TypeScript/issues/17222

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground link with relevant code

💻 Code

const a = { a!: 1 };

🙁 Actual behavior

There's no error; crashes at runtime

🙂 Expected behavior

There should be an error

貢獻者指南