Skip to content

Could I build a nested Pick from dot path notation with Hotscript? #73

Answered by gvergnaud
nandorojo asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! I think you are looking for the Object.Get or the Objects.Update function: Playground

import * as H from 'hotscript'


type Filter = { booking: { startTime: { id: string } } }

type res1 = H.Eval<
//    ^? { booking: { startTime: "asc" | "desc" } }
  H.Objects.Update<"booking.startTime", "asc" | "desc", Filter>
>;

type res2 = H.Eval<
//    ^? { id: string }
  H.Objects.Get<"booking.startTime", Filter>
>;

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gvergnaud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants