TypeScript: Argument Validation

Only TS Generics to rescue

getOneById<T extends keyof Student>(id: number, fields: Record<T, 1>  ): Pick<Student, T>

--

--

We are business accelerator working with startups / entrepreneurs in building the product & launching the companies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
LiftOff LLC

We are business accelerator working with startups / entrepreneurs in building the product & launching the companies.