You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
declarefunctiontest1<Textends{x: string}>(a: T,b: NoInfer<T>|(()=>NoInfer<T>),): void;test1({x: "foo"},{x: "bar"});// an incorrect epc errortest1({x: "foo"},{x: "bar",y: 42});// epc error but on a wrong propertydeclarefunctiontest2<Textends{x: string}>(a: T,b: NoInfer<T>|NoInfer<()=>T>,): void;test2({x: "foo"},{x: "bar"});test2({x: "foo"},{x: "bar",y: 42});// should have an epc errordeclarefunctiontest3<Textends{x: string}>(a: T,b: NoInfer<T|(()=>T)>,): void;// those work finetest3({x: "foo"},{x: "bar"});test3({x: "foo"},{x: "bar",y: 42});declareconstpartialObj1: Partial<{a: unknown;b: unknown}>;declareconstpartialObj2: Partial<{c: unknown;d: unknown}>;declareconstsomeObj1: {x: string};declarefunctiontest4<T>(a: T,b: NoInfer<T>&{prop?: unknown}): void;test4(partialObj1,someObj1);// should report no common props errordeclarefunctiontest5<T1,T2>(a: T1,b: T2,c: NoInfer<T1>&NoInfer<T2>,): void;test5(partialObj1,partialObj2,someObj1);// should report no common props errordeclarefunctiontest6<T1,T2>(a: T1,b: T2,c: NoInfer<T1&T2>): void;test6(partialObj1,partialObj2,someObj1);// this one works ok
π Actual behavior
Excess property check doesn't work properly when union members are wrapped by NoInfer individually. Similarly common properties check doesn't work properly with intersections when its members are wrapped by NoInfer individually
π Expected behavior
I've annotated the playground with expected results where appropriate
π Search Terms
epc excess common properties weak type noinfer
π Version & Regression Information
NoInfer
was introduced in 5.4β― Playground Link
https://www.typescriptlang.org/play?ts=5.5.0-dev.20240308#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXwxAGcMBGAHgBV4QAPQ1YI+Ab3loC54SYtUBzeAF8AfAAoAUPHhQulADRT4AIy4A5HAElUiEDCoj4AH3hixASngBeQxu279lEecXmuANxxZgAbgkTCElIxNk54ACJEHBxw4XlWdi5w5VhYoXMfeAB6LJl8PjAcGDhMGgAHMBpiooDiMhDEiKiYuISw5NT4gE8uABYAJmEM7NyQCqqYIpVkDHg8GXgAd0mBeDLJsr0MLv9QSFgEFHRsecCMfqoaehBGZlCuHj5BUUlpWXgFJVV4Ox09A2MPy0f30Fmshicrg8Xl8-jO-Qa7WaaXi9wiKRgaQytRICLRkWiKLaSQx4W6fUG6UyOW4AAscMgIMB4LSoO4EFB8GNKnpJjBduBoHAkGhMLh8GcAMyXOgMJjE7gYXirF5Kd6faTfX4OS4mMyWGwfcwiKHwTzePwSGkYelEBCLIoAayQfBAOIwksRSWRrXxpKGfilXqahN9jQ6mPJ8AGAYF+2FhVQJDWsGwUAgAHllAArUhcAAKqaw6fIbHeaEdqBwi1QmW+FarNeEIj8eyFCETybKRfTWez-QLPYgpfgYC4DertfgwHHqErk+brcFB1HeGTRBwAFsQH28wrHirLW2V0cxac6r0DGJ1fEtcCdU54AAyBLrHBlAD8s-nTfS0ItcIXmI3YwGmmY5qQ8Qbtuu7DDSRD0oyzJwGURSzFWq6bpu8xvmUzC8jUEjHsKp4nBKdQAKxUJBHz9OIapyJBXxyP0ijSGOQL2P8lCkIYL7atxdGmuasLuhRwFDru8QgWBfasdwW47hBcG5AhDJMvAKFofAGGFFhOEbPh1T8kRy4kaKZEEHUABs1HxJQdHXoxt4sfEHECY4pDPrRzj-qJZzWRJoHFuBubSZJObydBSm5ipBC0lgzB4PaTpJY6EhAA
π» Code
π Actual behavior
Excess property check doesn't work properly when union members are wrapped by
NoInfer
individually. Similarly common properties check doesn't work properly with intersections when its members are wrapped byNoInfer
individuallyπ Expected behavior
I've annotated the playground with expected results where appropriate
Additional information about the issue
this open PR fixes it: #57673
The text was updated successfully, but these errors were encountered: