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
{{ message }}
Repository navigation
Breaking change to extends any causes confusing behavior with indirect references to any #38555
store.user = "test" should succeed without failure.
Actual behavior:
Because KSMConfig["store"] is typed as any, due to the breaking change made in 3.9 to the behavior of extends any, the type gets reinterpreted as unknown and the compiler exclaims:
Third-party typings for Javascript libraries often substitute any for incomplete types. This breaking change makes it hard to write functions that transform third-party types that reduce to any.
Using type assertions to fixup the type afterward is cumbersome.
(store as KSMConfig["store"]).user = "test";
Could the change be relaxed to alias any to unknownonly when any is explicitly requested? i.e.
functionfoo<Textendsany>(x: T){// x is unknown}typeSomeType=any;functionbar<TextendsSomeType>(x: T){// x is SomeType (any)}
Activity
webstrand commentedon Jul 12, 2022
I haven't had any further trouble with this change.