@justeattakeaway/pie-webc-core 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/component-default-props-generic.ts +31 -0
- package/src/types/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[36mvite v4.5.3 [32mbuilding for production...[36m[39m
|
|
2
2
|
transforming...
|
|
3
|
-
[32m✓[39m
|
|
3
|
+
[32m✓[39m 16 modules transformed.
|
|
4
4
|
rendering chunks...
|
|
5
5
|
computing gzip size...
|
|
6
6
|
[2mdist/[22m[36mindex.js [39m[1m[2m2.66 kB[22m[1m[22m[2m │ gzip: 1.20 kB[22m
|
|
7
|
-
[32m✓ built in
|
|
7
|
+
[32m✓ built in 205ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [Changed] - Update default props generic helper type to include all props by default ([#1582](https://github.com/justeattakeaway/pie/pull/1582)) by [@xander-marjoram](https://github.com/xander-marjoram)
|
|
8
|
+
|
|
9
|
+
[Changed] - Naming of generic type
|
|
10
|
+
[Added] - JSDoc comment
|
|
11
|
+
|
|
12
|
+
## 0.23.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [Added] - Generic type for components default props ([#1451](https://github.com/justeattakeaway/pie/pull/1451)) by [@fernandofranca](https://github.com/fernandofranca)
|
|
17
|
+
|
|
3
18
|
## 0.22.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This type should be used when defining the default props for a component.
|
|
3
|
+
* It is a generic type that takes two type parameters:
|
|
4
|
+
* - `T` is the type of the props object that the default props are being defined for.
|
|
5
|
+
* - `K` is the type of the keys in `T` that should be required in the default props.
|
|
6
|
+
* By default, `K` is set to be all the keys in `T`. This means that all the keys in `T` will be required in the default props.
|
|
7
|
+
* You can override this by specifying a subset of the keys in `T` that should be required in the default props.
|
|
8
|
+
*
|
|
9
|
+
* @example ```tsx
|
|
10
|
+
* interface MyComponentProps {
|
|
11
|
+
* a: string;
|
|
12
|
+
* b?: number;
|
|
13
|
+
* c: boolean;
|
|
14
|
+
* }
|
|
15
|
+
* const allProps: ComponentDefaultProps<MyComponentProps> = {
|
|
16
|
+
* a: 'default value',
|
|
17
|
+
* b: 42,
|
|
18
|
+
* c: true,
|
|
19
|
+
* };
|
|
20
|
+
*
|
|
21
|
+
* const pickProps: ComponentDefaultProps<MyComponentProps, 'a'> = {
|
|
22
|
+
* a: 'default value',
|
|
23
|
+
* };
|
|
24
|
+
*
|
|
25
|
+
* const omitProps: ComponentDefaultProps<MyComponentProps, keyof Omit<MyComponentProps, 'a'>> = {
|
|
26
|
+
* b: 42,
|
|
27
|
+
* c: true,
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export type ComponentDefaultProps<T, K extends keyof T = keyof T> = Readonly<Required<Pick<T, K>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './component-default-props-generic';
|