bcherny/json-schema-to-typescript

Option for adding `undefined` to optional union for optional properties.

Open

#604 创建于 2024年6月23日

在 GitHub 查看
 (4 评论) (1 反应) (0 负责人)TypeScript (449 fork)github user discovery
enhancementgood first issuehelp wanted

仓库指标

Star
 (3,302 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

In TypeScript, when exactOptionalPropertyTypes is set to true, properties that are optional?: but not do not include | undefined in their union can not be assigned a value of undefined.

For generating code that will be consumed by others, we may not want to force them to turn off exactOptionalPropertyTypes. For that please consider an option to include undefined in generated type unions of non-required properties.

贡献者指南