TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Bloomberg TS 5.6 Beta Feedback

Open murtyjones opened this issue 1 year ago • 0 comments

Acknowledgement

  • [X] I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

We are in the process of evaluating the impact of TS 5.6 beta on Bloomberg code. Below are preliminary findings.

Overall, the only new diagnostics produced by this release are the excellent improvements to nullish/truthy checks.

Change Impacts Release notes Packages impacted
New nullish/truthy diagnostics Type checker Disallowed Nullish and Truthy Checks ~one dozen

Stricter type-checking of partial objects

We observed new errors related to nullish/truthy checks, all of which look like correct diagnostics. A few simplified examples are below:

const err = "bar";

// Right operand of ?? is unreachable because the left operand is never nullish.(2869)
const errorMessage = "foo " + err ?? "Unknown error";
// Right operand of ?? is unreachable because the left operand is never nullish.(2869)
const isActive = !someCondition ?? true;
// This kind of expression is always truthy.(2872)
if (myCheck === "foo" || "bar") {

}

murtyjones avatar Aug 27 '24 18:08 murtyjones