millsp / ts-toolbelt

πŸ‘· TypeScript's largest type utility library

Home Page:https://millsp.github.io/ts-toolbelt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Narrow` doesn't work properly on intersections with `{}` type

DetachHead opened this issue Β· comments

🐞 Bug Report

Describe the bug

Reproduce the bug

declare const foo: <T>(value: Narrow<T>) => void

foo<1 & {}>(2 as 2 & {}) //no error

Expected behavior

error, because 2 & {} is not assignable to 1 & {}

Possible Solution

Screenshots

Additional context

this is fixed in typescript 4.8 beta. so i'll close this assuming it was a typescript issue