Skip to content

Conversation

@falkenhawk
Copy link
Member

Handle | null unions properly. (e.g. for nullable BelongsToOneRelations).

Before PartialModelGraph was converting field: Model | null; to field?: Expression<Model | null>, and typescript throws errors for graphs with partial sub-graphs for those nullable relations. (expecting full instance of the model class)
Now it converts it properly to field?: PartialModelGraph<Model> | null 🎉

Handle `| null` unions properly. (e.g. for nullable `BelongsToOneRelations`).

Before `PartialModelGraph` was converting `field: Model | null;` to `field?: Expression<Model | null>`, and typescript throws errors for graphs with partial sub-graphs for those nullable relations. (expecting full instance of the model class)
Now it converts it properly to `field?: PartialModelGraph<Model> | null` 🎉
@falkenhawk falkenhawk force-pushed the fix-typings-for-graphs-with-nullable-fields branch from a03890e to 479a03d Compare March 28, 2023 10:59
@falkenhawk falkenhawk changed the base branch from upgrade-typescript-knex-node-types to master March 28, 2023 10:59
@falkenhawk falkenhawk merged commit b05d92f into master Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant