@shopify/useful-types
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -10,6 +10,8 @@ # Changelog | ||
## [Unreleased] | ||
### Added | ||
- Added new `DeepPartial` type. ([#456](https://github.com/Shopify/quilt/pull/456)) | ||
## [1.0.0] | ||
Initial release |
@@ -6,1 +6,4 @@ import { ComponentType } from 'react'; | ||
export declare type Props<T> = T extends ComponentType<infer P> ? P : never; | ||
export declare type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>; | ||
}; |
{ | ||
"name": "@shopify/useful-types", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -26,3 +26,4 @@ "description": "A few handy TypeScript types", | ||
"dependencies": { | ||
"@types/react": ">=16.4.0" | ||
"@types/react": ">=16.4.0", | ||
"tslib": "^1.9.3" | ||
}, | ||
@@ -29,0 +30,0 @@ "devDependencies": { |
@@ -63,1 +63,14 @@ # `@shopify/useful-types` | ||
``` | ||
- `DeepPartial<T>`: Recusively maps over all properties in a type and transforms them to be optional. Useful when you need to make optional all of the properties (and nested properties) of an existing type. | ||
```ts | ||
interface Obj { | ||
foo: string; | ||
bar: { | ||
baz: boolean; | ||
}; | ||
} | ||
type DeepPartialObj = DeepPartial<Obj>; // {foo?: string; bar?: { baz?: boolean }} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
4735
13
76
0
2
+ Addedtslib@^1.9.3
+ Addedtslib@1.14.1(transitive)