Closed
Description
Bug Report
π Search Terms
refine regression 4.3 refine never
π Version & Regression Information
Worked with 4.2, stopped working with 4.3 beta
β― Playground Link
π» Code
type Hash = string & {__hash: true};
function getHashLength(hash: Hash): number {
// A best effort check in case our function is used by people writing JS
if (typeof hash !== `string`)
throw new Error(`This doesn't look like a hash`);
return hash.length;
}
π Actual behavior
The hash
variable is incorrectly refined to never
.
π Expected behavior
The hash
variable should remain Hash
, since the typeof
check is coherent with Hash
.