@types/omit
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Installation

npm install --save @types/omit

Summary

This package contains type definitions for omit (https://github.com/DamonOehlman/omit#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/omit.

index.d.ts

type Key = string | readonly string[];
type KeyAsStringType<K extends Key> = K extends readonly string[] ? K[number] : K;
type Rule<K extends Key, V> = Key | ((key: K, value: V, target: Record<KeyAsStringType<K>, V>) => boolean);

type OmitMultiple<T, K extends Key> = Pick<T, Exclude<keyof T, KeyAsStringType<K>>>;
type MaybeOmitMultiple<T, K extends Key> =
    & OmitMultiple<T, K>
    & {
        [P in Extract<keyof T, KeyAsStringType<K>>]?: T[P];
    };

// Static key
declare function omit<K extends Key>(key: K): <T>(target: T) => T extends Array<infer T> ? Array<OmitMultiple<T, K>>
    : OmitMultiple<T, K>;
// Static key, with target
declare function omit<T, K extends Key>(key: K, target: T): T extends Array<infer T> ? Array<OmitMultiple<T, K>>
    : OmitMultiple<T, K>;
// Custom key
declare function omit<K extends Key>(
    rule: Rule<K, any>,
): <T>(target: T) => T extends Array<infer T> ? Array<MaybeOmitMultiple<T, K>>
    : MaybeOmitMultiple<T, K>;
// Custom key, with target
declare function omit<T, K extends Key>(
    key: Rule<K, any>,
    target: T,
): T extends Array<infer T> ? Array<MaybeOmitMultiple<T, K>>
    : MaybeOmitMultiple<T, K>;

export = omit;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by Rajas Paranjpe.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.382ts4.6
1.0.382ts4.7
1.0.382ts4.8
1.0.382ts4.9
1.0.382ts5.0
1.0.382ts5.1
1.0.382ts5.2
1.0.382ts5.3
1.0.382ts5.4
1.0.382ts5.5
1.0.382ts5.6
1.0.382ts5.9
1.0.05ts3.7
1.0.05ts3.8
1.0.05ts3.9
1.0.05ts4.0
1.0.05ts4.1
1.0.05ts4.2
1.0.10ts4.3
1.0.10ts4.4
1.0.382ts5.8
1.0.382ts5.7
1.0.382latest
1.0.382ts4.5

Version History

VersionDownloads (Last 7 Days)Published
1.0.382
1.0.20
1.0.10
1.0.05

Package Sidebar

Install

npm i @types/omit

Weekly Downloads

64

Version

1.0.3

License

MIT

Unpacked Size

4.9 kB

Total Files

5

Last publish

Collaborators

  • types