Sfoglia il codice sorgente

types(shared): Improve LooseRequired<T> (#6244)

引证 3 anni fa
parent
commit
cbc3e67c37
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      packages/shared/src/typeUtils.ts

+ 1 - 1
packages/shared/src/typeUtils.ts

@@ -5,7 +5,7 @@ export type UnionToIntersection<U> = (
   : never
 
 // make keys required but keep undefined values
-export type LooseRequired<T> = { [P in string & keyof T]: T[P] }
+export type LooseRequired<T> = { [P in keyof (T & Required<T>)]: T[P] }
 
 // If the the type T accepts type "any", output type Y, otherwise output type N.
 // https://stackoverflow.com/questions/49927523/disallow-call-with-any/49928360#49928360