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
Compiler prematurely resolves Key to unknown[] in test2
π Expected behavior
Compiler should emit declaration of test2 same as test1 (except the "?" part of course), it should not prematurely resolve Key to unknown[] because one could add a key property to Types via module augmentation which makes the Key type no longer unknown[]
The text was updated successfully, but these errors were encountered:
adding |undefined to the optional parameter fixes this. I suspect the adding of | undefined is to support legacy stuff and it resolves early, if you explicitly say the optional parameter can be passed as undefined then it doesn't need to try to resolve your type to see if adding it would be redundant.
Bug Report
π Search Terms
optional parameter, resolution of types, declaration, optimization
π Version & Regression Information
v4.4.4
β― Playground Link
Playground for
test1.ts
Playground fortest2.ts
π» Code
π Actual behavior
Compiler prematurely resolves
Key
tounknown[]
in test2π Expected behavior
Compiler should emit declaration of test2 same as test1 (except the "?" part of course), it should not prematurely resolve
Key
tounknown[]
because one could add akey
property toTypes
via module augmentation which makes theKey
type no longerunknown[]
The text was updated successfully, but these errors were encountered: