Skip to content

exclude undefined type from builder setter#29

Open
KhalitovAdel wants to merge 2 commits intoVincent-Pang:masterfrom
KhalitovAdel:hotfix/undefinedInBuilder
Open

exclude undefined type from builder setter#29
KhalitovAdel wants to merge 2 commits intoVincent-Pang:masterfrom
KhalitovAdel:hotfix/undefinedInBuilder

Conversation

@KhalitovAdel
Copy link
Copy Markdown

No description provided.

Comment thread src/Builder.ts
@@ -1,5 +1,5 @@
export type IBuilder<T> = {
[k in keyof T]-?: ((arg: T[k]) => IBuilder<T>) & (() => T[k]);
[k in keyof T]-?: ((arg: Exclude<T[k], undefined>) => IBuilder<T>) & (() => T[k]);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vincent-Pang

I really don't know why we can see getters in builder, but may be need to change getter return type to (() => T[k] | undefined)

?

@KhalitovAdel KhalitovAdel changed the title Hotfix/undefined in builder exclude undefined type from builder setter May 20, 2023
@samchungy
Copy link
Copy Markdown

samchungy commented Aug 31, 2023

What if you wanted to set the field to undefined? Eg. If the type is X | undefined

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.

2 participants