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 2.0.2 to 2.1.0

8

CHANGELOG.md

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

## [Unreleased]
## [2.1.0] - 2019-10-30
### Added
- Added the `NoInfer<T>` type alias.
## [2.0.0]

@@ -10,0 +18,0 @@

3

dist/types.d.ts

@@ -26,4 +26,7 @@ export declare type ThenType<T> = T extends Promise<infer U> ? U : T;

}[keyof T];
export declare type NoInfer<T> = {
[K in keyof T]: T[K];
} & T;
declare type ReactStatics = 'displayName' | 'getDerivedStateFromProps' | 'getDerivedStateFromErrors' | 'childContextTypes' | 'contextType' | 'contextTypes' | 'getDefaultProps' | 'propTypes';
export declare type NonReactStatics<T> = Pick<T, Exclude<keyof T, ReactStatics>>;
export {};

2

package.json
{
"name": "@shopify/useful-types",
"version": "2.0.2",
"version": "2.1.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "A few handy TypeScript types",

@@ -75,1 +75,10 @@ # `@shopify/useful-types`

```
- `NoInfer<T>`: creates a ["lower priority inference site"](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-320754731), which allows other uses of a generic to take precedence in inference.
```ts
// Here, TypeScript will always use the type of the items in the `items` argument as `T`, and will not consider the type of the `item` argument of `renderItem`.
function render<T>(items: T[], renderItem: (item: NoInfer<T>) => string) {
/* implementation */
}
```
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