Socket
Socket
Sign inDemoInstall

@shopify/useful-types

Package Overview
Dependencies
Maintainers
19
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.3.4 to 2.4.0-graphql-config-beta.1

1

build/cjs/index.js

@@ -11,2 +11,3 @@ "use strict";

if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _types[key]) return;
Object.defineProperty(exports, key, {

@@ -13,0 +14,0 @@ enumerable: true,

@@ -11,2 +11,3 @@ "use strict";

if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _types[key]) return;
Object.defineProperty(exports, key, {

@@ -13,0 +14,0 @@ enumerable: true,

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

export declare type MaybeFunctionReturnType<T> = T extends (...args: any[]) => infer U ? U : never;
export declare type ArrayElement<T> = T extends (infer U)[] ? U : never;
export declare type ArrayElement<T> = T extends Array<infer U> ? U : never;
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export declare type DeepPartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial<U>[] : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : DeepPartial<T[P]>;
[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]>;
};

@@ -38,3 +38,11 @@ export declare type IfEmptyObject<Obj, If, Else = never> = keyof Obj extends {

export declare type FirstConstructorArgument<T> = ConstructorArgumentAtIndex<T, 0>;
declare type Primitive = string | Function | number | boolean | Symbol | undefined | null;
declare type DeepOmitHelper<T, K extends keyof T> = {
[P in K]: T[P] extends infer TP ? TP extends Primitive ? TP : TP extends any[] ? DeepOmitArray<TP, K> : DeepOmit<TP, K> : never;
};
export declare type DeepOmit<T, K> = T extends Primitive ? T : DeepOmitHelper<T, Exclude<keyof T, K>>;
export declare type DeepOmitArray<T extends any[], K> = {
[P in keyof T]: DeepOmit<T[P], K>;
};
export {};
//# sourceMappingURL=types.d.ts.map

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

## 2.4.0 - 2021-04-23
### Added
- Add `DeepOmit` and `DeepOmitArray` type to recursively omit field from nested type definition [#1807](https://github.com/Shopify/quilt/pull/1807)
## 2.3.4 - 2021-04-13

@@ -12,0 +18,0 @@

2

index.js

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

module.exports = require("./build/node/index.js");
module.exports = require("./build/cjs/index.js");
{
"name": "@shopify/useful-types",
"version": "2.3.4",
"version": "2.4.0-graphql-config-beta.1",
"license": "MIT",

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

@@ -109,1 +109,28 @@ # `@shopify/useful-types`

```
- `DeepOmit<T, K>` Recursively maps over all properties in a type and omits those matching `K`.
```ts
interface Obj {
__typename: string;
foo: string;
bar: {
__typename: string,
baz: string
};
}
type SelectiveObj = DeepOmit<Obj, '__typename'>; // {foo: string; bar: {baz: string}}
```
- `DeepOmitArray<T extends any[], K>` Iterate over all properties in an array of types and omits those matching `K`.
```ts
interface Obj {
__typename: string;
foo: string;
}
type SelectiveObj = DeepOmitArray<Obj[], '__typename'>; // {foo: string}[]
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc