Socket
Socket
Sign inDemoInstall

@shopify/useful-types

Package Overview
Dependencies
Maintainers
13
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/useful-types - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0

4

CHANGELOG.md

@@ -8,2 +8,6 @@ # Changelog

## [2.0.0]
- Removed `Props<T>`, see `ComponentProps`, `ComponentPropsWithRef`, and `ComponentPropsWithoutRef` from `react` for a replacement strategy ([#846](https://github.com/Shopify/quilt/pull/846))
## [1.3.0]

@@ -10,0 +14,0 @@

2

dist/types.d.ts

@@ -1,2 +0,1 @@

import { ComponentType, HTMLAttributes } from 'react';
export declare type ThenType<T> = T extends Promise<infer U> ? U : T;

@@ -12,3 +11,2 @@ export declare type Arguments<T> = T extends (...args: infer U) => any ? U : never;

};
export declare type Props<T> = T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : T extends string ? HTMLAttributes<T> : T extends ComponentType<infer Props> ? Props : never;
export declare type IfEmptyObject<Obj, If, Else = never> = keyof Obj extends {

@@ -15,0 +13,0 @@ length: 0;

{
"name": "@shopify/useful-types",
"version": "1.3.0",
"version": "2.0.0",
"license": "MIT",

@@ -26,3 +26,2 @@ "description": "A few handy TypeScript types",

"dependencies": {
"@types/react": ">=16.4.0",
"tslib": "^1.9.3"

@@ -29,0 +28,0 @@ },

@@ -63,19 +63,2 @@ # `@shopify/useful-types`

- `Props<T>`: Extracts the prop type from a React component. This allows you to access property types without having to manually export/ import the type.
```tsx
function MyComponent({name}: {name: string}) {
return <div>Hello, {name}!</div>;
}
class MyOtherComponent extends React.Component<{seconds: number}> {
render() {
return <div>{this.props.seconds} seconds left!</div>;
}
}
type MyComponentProps = Props<typeof MyComponent>; // {name: string}
type MyOtherComponentProps = Props<typeof MyOtherComponent>; // {seconds: number}
```
- `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.

@@ -82,0 +65,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc