@leafygreen-ui/lib
Advanced tools
Comparing version 13.7.0 to 13.8.0
127
CHANGELOG.md
# @leafygreen-ui/lib | ||
## 13.8.0 | ||
### Minor Changes | ||
- fbd0a7310: Adds multiple `Deep` TS utility types, and `Concat` type. | ||
### Concat | ||
Concatenates two string literals with a separator. | ||
```ts | ||
type A = 'apple'; | ||
type B = 'banana'; | ||
Concat<A, B, '.'>; // 'apple.banana' string literal | ||
``` | ||
### `DeepKeys` | ||
Given some deep interface, `DeepKeys` returns all possible deep keys | ||
as a union of dot-separated string literals. | ||
```ts | ||
interface MyInterface { | ||
a: { | ||
b: { | ||
c: any; | ||
d: any; | ||
}; | ||
e: any; | ||
}; | ||
f: any; | ||
} | ||
DeepKeys<MyInterface>; // 'a' | 'a.b' | 'a.b.c' | 'a.b.d' | 'a.e' | 'f' | ||
``` | ||
### `DeepPartial` | ||
Given some deep interface, `DeepPartial` returns a recursive partial of the given interface. | ||
```ts | ||
interface MyInterface { | ||
a: { | ||
b: { | ||
c: any; | ||
d: any; | ||
}; | ||
e: any; | ||
}; | ||
f: any; | ||
} | ||
const x = { | ||
a: { | ||
b: { | ||
d: 'foo', | ||
}, | ||
}, | ||
} satisfies DeepPartial<MyInterface>; | ||
``` | ||
### `DeepPathValues` | ||
Given some deep interface, `DeepPathValues` maps the deep keys of an object to their path values. | ||
```ts | ||
interface MyInterface { | ||
a: { | ||
b: { | ||
c: any; | ||
d: any; | ||
}; | ||
e: any; | ||
}; | ||
f: any; | ||
} | ||
const x = { | ||
a: { | ||
b: { | ||
c: 'a.b.c', | ||
d: 'a.b.d', | ||
}, | ||
e: 'a.e', | ||
}, | ||
f: 'f', | ||
} satisfies DeepPathValues<MyInterface>; | ||
``` | ||
### `DeepPick` | ||
Given some deep interface, `DeepPick` deeply picks the specified dot-separated keys from the object | ||
```ts | ||
interface MyInterface { | ||
a: { | ||
b: { | ||
c: any; | ||
d: any; | ||
}; | ||
e: any; | ||
}; | ||
f: any; | ||
} | ||
DeepPick<MyInterface, 'a.b'>; // { a: { b: any } } | ||
``` | ||
### `DeepUnion` | ||
Given some deep constant, `DeepUnion` returns a recursive union the values for a given type. | ||
```ts | ||
const MyObj = { | ||
a: { | ||
b: { | ||
c: 'carrot' | ||
}, | ||
d: 'dragon' | ||
} | ||
e: 'eggplant' | ||
} as const | ||
DeepUnion<typeof MyObj> // 'carrot' | 'dragon' | 'eggplant' | ||
``` | ||
## 13.7.0 | ||
@@ -4,0 +131,0 @@ |
@@ -0,1 +1,7 @@ | ||
export type { Concat } from './Concat.types'; | ||
export type { DeepKeys } from './DeepKeys.types'; | ||
export type { DeepPartial } from './DeepPartial.types'; | ||
export type { DeepPathValues } from './DeepPathValues.types'; | ||
export type { DeepPick } from './DeepPick.types'; | ||
export type { DeepUnion } from './DeepUnion.types'; | ||
export type { ExclusiveUnion } from './ExclusiveUnion.types'; | ||
@@ -2,0 +8,0 @@ export type { Mutable } from './Mutable.types'; |
{ | ||
"name": "@leafygreen-ui/lib", | ||
"version": "13.7.0", | ||
"version": "13.8.0", | ||
"description": "leafyGreen UI Kit Internal Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -0,1 +1,7 @@ | ||
export type { Concat } from './Concat.types'; | ||
export type { DeepKeys } from './DeepKeys.types'; | ||
export type { DeepPartial } from './DeepPartial.types'; | ||
export type { DeepPathValues } from './DeepPathValues.types'; | ||
export type { DeepPick } from './DeepPick.types'; | ||
export type { DeepUnion } from './DeepUnion.types'; | ||
export type { ExclusiveUnion } from './ExclusiveUnion.types'; | ||
@@ -2,0 +8,0 @@ export type { Mutable } from './Mutable.types'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
198672
120
2843