Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to turn properties into X | null? #51

Closed
xaviergonz opened this issue Sep 24, 2019 · 3 comments
Closed

Way to turn properties into X | null? #51

xaviergonz opened this issue Sep 24, 2019 · 3 comments
Labels
question More info is requested wiki It's nice to learn stuff

Comments

@xaviergonz
Copy link

Is there something like O.Nullable but that actually makes keys turn into V | null?
e.g.

interface A { x: number; y: number }
type AN = O.NullNullable<A, "x">
// AN is { x: number | null; y: number }
@millsp
Copy link
Owner

millsp commented Sep 24, 2019

Yes, you can use Update

@millsp millsp closed this as completed Sep 24, 2019
@xaviergonz
Copy link
Author

Is this supposed to work then? It doesn't for me

interface A {y: number}
type C = O.Update<A, "y", A.x | null>
const c: C = {y: 4} // complains about 'y' being a number

@xaviergonz
Copy link
Author

Nevermind, didn't work on 4.1.0 but works on 4.3.0

@millsp millsp added question More info is requested wiki It's nice to learn stuff labels Jul 9, 2020
Repository owner locked and limited conversation to collaborators Feb 2, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question More info is requested wiki It's nice to learn stuff
Projects
None yet
Development

No branches or pull requests

2 participants