-
Notifications
You must be signed in to change notification settings - Fork 72
/
types.ts
89 lines (78 loc) · 2.79 KB
/
types.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
export interface WebFeaturesData {
/** Browsers and browser release data */
browsers: { [key in BrowserIdentifier]: BrowserData };
/** Feature identifiers and data */
features: { [key: string]: FeatureData };
/** Group identifiers and data */
groups: { [key: string]: GroupData };
/** Snapshot identifiers and data */
snapshots: { [key: string]: SnapshotData };
}
/** Browser information */
export interface BrowserData {
/** The name of the browser, as in "Edge" or "Safari on iOS" */
name: string;
/** The browser's releases */
releases: Release[];
}
/** Browser release information */
export interface Release {
/** The version string, as in "10" or "17.1" */
version: string;
/** The release date, as in "2023-12-11" */
date: string;
}
export interface FeatureData {
/** Short name */
name: string;
/** Short description of the feature, as a plain text string */
description: string;
/** Short description of the feature, as an HTML string */
description_html: string;
/** Specification */
spec: specification_url | [specification_url, specification_url, ...specification_url[]];
/** Group identifier */
group?: string | [string, string, ...string[]];
/** Snapshot identifier */
snapshot?: string | [string, string, ...string[]];
/** caniuse.com identifier */
caniuse?: string | [string, string, ...string[]];
/** Whether a feature is considered a "baseline" web platform feature and when it achieved that status */
status: SupportStatus;
/** Sources of support data for this feature */
compat_features?: string[];
}
type BrowserIdentifier = "chrome" | "chrome_android" | "edge" | "firefox" | "firefox_android" | "safari" | "safari_ios";
type BaselineHighLow = "high" | "low";
interface Status {
/** Whether the feature is Baseline (low substatus), Baseline (high substatus), or not (false) */
baseline: BaselineHighLow | false;
/** Date the feature achieved Baseline low status */
baseline_low_date?: string;
/** Date the feature achieved Baseline high status */
baseline_high_date?: string;
/** Browser versions that most-recently introduced the feature */
support: {
[K in BrowserIdentifier]?: string;
};
}
interface SupportStatus extends Status {
/** Statuses for each key in the feature's compat_features list, if applicable. Not available to the npm release of web-features. */
by_compat_key?: Record<string, Status>
}
/** Specification URL
* @format uri
*/
type specification_url = string;
export interface GroupData {
/** Short name */
name: string;
/** Identifier of parent group */
parent?: string;
}
export interface SnapshotData {
/** Short name */
name: string;
/** Specification */
spec: specification_url;
}