-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathtypes.ts
More file actions
40 lines (35 loc) · 750 Bytes
/
types.ts
File metadata and controls
40 lines (35 loc) · 750 Bytes
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
export type AssetDiff = {
name: string
new: {
size: number
gzipSize: number | null
}
old: {
size: number
gzipSize: number | null
}
diff: number
diffPercentage: number
}
export interface Sizes {
size: number
gzipSize: number | null
}
export interface ChunkSizes extends Sizes {
initial: boolean
}
export function isChunkSizes(sizes: Sizes): sizes is ChunkSizes {
return 'initial' in sizes
}
interface _WebpackStatsDiff {
added: AssetDiff[]
removed: AssetDiff[]
bigger: AssetDiff[]
smaller: AssetDiff[]
unchanged: AssetDiff[]
total: AssetDiff
initial?: AssetDiff
}
export type WebpackStatsDiff<T extends Sizes> = T extends ChunkSizes
? _WebpackStatsDiff
: Omit<_WebpackStatsDiff, 'initial'>