sindresorhus / type-fest

A collection of essential TypeScript types
Creative Commons Zero v1.0 Universal
14.42k stars 548 forks source link

OmitDeep - when omitting multiple optional fields final type goes wrong #966

Open vilola opened 1 month ago

vilola commented 1 month ago

Bug description

When OmitDeep multiple optional fields, final type is not correct. See example.

Repro

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBDAnmApnA3geRMGARFFMAXzgDMoIQ4ByJVAWjJQGcYaBuAWAChf60mMDGAQAdgEMANgDlWMFABM4AXgy84muBIBc6nlsNwARgH496DUesC9bKMDEBzbgetxir93ADG5-d6GtnD2ji5W1p4RRor+lm6BCMgodjAOzl7uUQkergCQTv4ARKHORQA0vHkAFsWlThW82fzJcHJsSqoBWrrd1sYW0d7B9ZmRY0Y+gznDyanp4TNa2d6K04maI2lhE4Yry-lOeiXbZZU8Ncf1jTzNPAD093AACpTGUiggEiI+cGASsBaqDgBCIQhE4mkABV5F1sLhQWAADzg0SSWTyJTlOBFCQAOmMRTgAB8cfifEUAHwTR5wAB6pl4vFpAHVcNU4GIIPAIMI0dJyMAUFJFCw4LgxQB3aAAazCQLQiJhbDhOHwhGR7QUimxuIJRNJeop1KZDyeUN5cA+ADdhXB4fBpVA5c44JL2XBeRD0Qr7XzIVJlfA1A6Uf70VqsTiGiScdUqdFaQzeEA

Upvote & Fund

Fund with Polar

Emiyaaaaa commented 2 days ago

You mean the result has extra undefined?

Try set exactOptionalPropertyTypes: true in tsconfig.