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
Describe the bug Exact optional property types restrict the type of optional properties (e.g. foo?: string) to either be defined or not, but not equivalent to | undefined (as was the previous behavior); per microsoft/TypeScript#43947. This causes errors with several optional properties defined in types.d.ts, since there are several points at which properties are set assuming that undefined is synonymous with optional (e.g. prop? => string | undefined).
TSConfig provides an exactOptionalPropertyTypes option that can be set in tsconfig.json files to enforce Exact Optional Property Types (introduced in TypeScript 4.4) using the TypeScript type-checker. Additionally, the exactOptionalPropertyTypes requires that strictNullChecks also be enabled in TSConfig.
Describe the bug
Exact optional property types restrict the type of optional properties (e.g.
foo?: string
) to either be defined or not, but not equivalent to| undefined
(as was the previous behavior); per microsoft/TypeScript#43947. This causes errors with several optional properties defined intypes.d.ts
, since there are several points at which properties are set assuming that undefined is synonymous with optional (e.g.prop? => string | undefined
).To Reproduce
Steps to reproduce the behavior:
typescript >= 4.4
modals.ts
.subtype
,target
, andoptions
, which indicate:Expected behavior
Allow optional properties to be synonymous with
undefined
(e.g.const bar?: string => string | undefined
).Screenshots

Versions (please complete the following information):
development
)Additional context
Additional discussion regarding the impact of this breaking change can be found at microsoft/TypeScript#44421.
The text was updated successfully, but these errors were encountered: