Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 46 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { EMPTY_OBJECT } from "./consts" |
||
2 | import type { ReactRelated, ClassNamesFrom, CssModule, ClassHash } from "./defs" |
||
3 | |||
4 | export { |
||
5 | classNamesCheck |
||
6 | } |
||
7 | |||
8 | //TODO On assignment |
||
9 | /** Checks equality |
||
10 | * @example classNamesCheck<typeof App, typeof require("./module.css")>(module?) // Will return notation as array of not used classes |
||
11 | * @todo On parameter: |
||
12 | * @example classNamesCheck<typeof App>(require("./module.css")) |
||
13 | */ |
||
14 | |||
15 | /** Identical function */ |
||
16 | function classNamesCheck<T extends CssModule>(classnames: T): T |
||
17 | |||
18 | /** Declares class keys |
||
19 | * @example |
||
20 | * classNamesCheck() // Anything |
||
21 | * classNamesCheck<typeof Component>() |
||
22 | */ |
||
23 | function classNamesCheck(): never |
||
24 | |||
25 | /** |
||
26 | * Overrides argument's shape. |
||
27 | * For checking equality add `typeof css_module` as second generic parameter |
||
28 | */ |
||
29 | function classNamesCheck<K extends ReactRelated>(classnames: {[k: string]: ClassHash}): ClassNamesFrom<K> |
||
30 | |||
31 | /** |
||
32 | * Check redundant keys |
||
33 | */ |
||
34 | function classNamesCheck< |
||
35 | K extends ReactRelated, |
||
36 | T extends ClassNamesFrom<K> = ClassNamesFrom<K> |
||
37 | >(classnames?: T): string extends keyof T ? ClassNamesFrom<K> |
||
38 | : keyof T extends keyof ClassNamesFrom<K> ? T |
||
39 | // For Verbosing redundant keys |
||
40 | : Exclude<keyof T, keyof ClassNamesFrom<K>>[] |
||
41 | |||
42 | |||
43 | function classNamesCheck(classnames = EMPTY_OBJECT) { |
||
44 | return classnames |
||
45 | } |
||
46 |