Conditions | 2 |
Total Lines | 25 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { ClassValue } from "../defs" |
||
4 | |||
5 | // type Excluder< |
||
6 | // S extends Record<string, ClassValue>, |
||
7 | // E extends {[K in keyof S]?: ClassValue} |
||
8 | // > = { [P in Exclude<keyof S, keyof E>]: S[P]; } |
||
9 | |||
10 | // interface Exclusion< |
||
11 | // S extends Record<string, ClassValue> |
||
12 | // > { |
||
13 | // (source: S, ex: {[K in keyof S]?: ClassValue}): Excluder<S, typeof ex> |
||
14 | // } |
||
15 | |||
16 | function exclusion< |
||
17 | E extends Record<string, ClassValue>, |
||
18 | S extends Record<keyof E, ClassValue> |
||
19 | >( |
||
20 | source: S, ex: E |
||
21 | ): { [P in Exclude<keyof S, keyof E>]: S[P]; } |
||
22 | { |
||
23 | const $return = {...source} |
||
24 | for (const k in ex) { |
||
25 | delete $return[k] |
||
26 | } |
||
27 | |||
28 | return $return |
||
29 | } |
||
42 | export {step2} |