-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathadditional.d.ts
75 lines (59 loc) · 1.89 KB
/
additional.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import 'react'
import { type StaticImageData } from 'next/Image'
declare global {
declare module '*.svg'
declare module '*.png'
declare module '*.jpg'
declare module '*.jpeg'
declare module '*.gif'
declare module '*.bmp'
declare module '*.tiff'
declare module '*.scss' {
interface IClassNames {
[className: string]: string
}
const scssClassNames: IClassNames
export = scssClassNames
}
declare module '*?url' {
const contents: StaticImageData
export = contents
}
// -----------------------------------------------------------
interface Window {
__env__: any
ethereum: any
opera: any
gtag: any
mixpanel: any
toggleMenu: () => void
closeMenuOnClickOutside: (e: MouseEvent) => void
}
// -----------------------------------------------------------
type AllOrNothing<T> = T | { [P in keyof T]?: never }
// type OneOrBothFromList = AtLeastOne<ExampleProps, 'to' | 'onClick'>
// type OneOrBothFromAll = AtLeastOne<ExampleProps>
type AtLeastOne<T, Keys extends keyof T = keyof T> =
Pick<T, Exclude<keyof T, Keys>>
& {
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>
}[Keys]
// type OneOrOtherFromList = OnlyOne<ExampleProps, 'to' | 'onClick'>
// type OneOrOtherFromAll = OnlyOne<ExampleProps>
type OnlyOne<T, Keys extends keyof T = keyof T> =
Pick<T, Exclude<keyof T, Keys>>
& {
[K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>
}[Keys]
type ChangeFields<T, R> = Omit<T, keyof R> & R
// type SomePartial = PartialBy<Props, 'title'>
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
declare module React {
type CFC<P = {}> = FC<{ children?: ReactNode } & P>
type FCC<P = {}> = FC<{ className?: string } & P>
interface CSSProperties {
[key: `--${string}`]: string | number
}
}
}
export {}