Designly
Aug 15, 2024

This is nonsense. You don’t even offer any reasons why it should not be done. You simply declare it—no pun intended.

Consider this:


declare type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;

I put that in my index.d.ts all the time as I use it everywhere. I don’t want to have to import the optional type in every file!

Designly
Designly

Written by Designly

Full-stack web developer and graphics designer.

Responses (1)