triangle-types 1.0.251 → 1.0.253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BallotpediaPerson } from "../ballotpedia/BallotpediaPerson.js";
|
|
2
1
|
import { FederalCongressMember } from "../federal_congress/FederalCongressMember.js";
|
|
3
2
|
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate.js";
|
|
4
3
|
export declare class Scout {
|
|
5
4
|
readonly scout_id: string;
|
|
5
|
+
readonly name: string;
|
|
6
6
|
readonly ballotpedia_person_id: number;
|
|
7
7
|
readonly s3_id_img?: string;
|
|
8
8
|
readonly [x: string]: any;
|
|
@@ -12,7 +12,6 @@ export declare class Scout {
|
|
|
12
12
|
export declare class ScoutAux extends Scout {
|
|
13
13
|
readonly federal_election_candidates: FederalElectionCandidate[];
|
|
14
14
|
readonly federal_congress_member?: FederalCongressMember;
|
|
15
|
-
readonly ballotpedia_person: BallotpediaPerson;
|
|
16
15
|
constructor(scout: any);
|
|
17
16
|
static is(scout: any): scout is ScoutAux;
|
|
18
17
|
}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { BallotpediaPerson } from "../ballotpedia/BallotpediaPerson.js";
|
|
2
1
|
import { FederalCongressMember } from "../federal_congress/FederalCongressMember.js";
|
|
3
2
|
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate.js";
|
|
4
|
-
// const scout_type_ids = ["I", "O"] as const
|
|
5
|
-
// export type ScoutTypeID = typeof scout_type_ids[number]
|
|
6
|
-
// export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
|
|
7
|
-
// return scout_type_ids.includes(scout_type_id)
|
|
8
|
-
// }
|
|
9
3
|
export class Scout {
|
|
10
4
|
scout_id;
|
|
11
|
-
|
|
12
|
-
// readonly name? : string
|
|
5
|
+
name;
|
|
13
6
|
ballotpedia_person_id;
|
|
14
7
|
// readonly wikipedia_article_id? : string
|
|
15
8
|
s3_id_img;
|
|
@@ -18,8 +11,7 @@ export class Scout {
|
|
|
18
11
|
throw Error("Invalid input.");
|
|
19
12
|
}
|
|
20
13
|
this.scout_id = scout.scout_id;
|
|
21
|
-
|
|
22
|
-
// this.name = scout.name
|
|
14
|
+
this.name = scout.name;
|
|
23
15
|
this.ballotpedia_person_id = scout.ballotpedia_person_id;
|
|
24
16
|
// this.wikipedia_article_id = scout.wikipedia_article_id
|
|
25
17
|
this.s3_id_img = scout.s3_id_img;
|
|
@@ -27,9 +19,8 @@ export class Scout {
|
|
|
27
19
|
static is(scout) {
|
|
28
20
|
return (scout !== undefined &&
|
|
29
21
|
typeof scout.scout_id === "string" &&
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
typeof scout.ballotpedia_person_id === "string" &&
|
|
22
|
+
typeof scout.name === "string" &&
|
|
23
|
+
typeof scout.ballotpedia_person_id === "number" &&
|
|
33
24
|
// (scout.wikipedia_article_id === undefined || typeof scout.wikipedia_article_id === "string") &&
|
|
34
25
|
(scout.s3_id_img === undefined || typeof scout.s3_id_img === "string"));
|
|
35
26
|
}
|
|
@@ -37,7 +28,6 @@ export class Scout {
|
|
|
37
28
|
export class ScoutAux extends Scout {
|
|
38
29
|
federal_election_candidates;
|
|
39
30
|
federal_congress_member;
|
|
40
|
-
ballotpedia_person;
|
|
41
31
|
constructor(scout) {
|
|
42
32
|
if (!ScoutAux.is(scout)) {
|
|
43
33
|
throw Error("Invalid input.");
|
|
@@ -45,39 +35,10 @@ export class ScoutAux extends Scout {
|
|
|
45
35
|
super(scout);
|
|
46
36
|
this.federal_election_candidates = scout.federal_election_candidates;
|
|
47
37
|
this.federal_congress_member = scout.federal_congress_member;
|
|
48
|
-
this.ballotpedia_person = scout.ballotpedia_person;
|
|
49
38
|
}
|
|
50
39
|
static is(scout) {
|
|
51
40
|
return (Scout.is(scout) &&
|
|
52
41
|
Array.isArray(scout.federal_election_candidates) && scout.federal_election_candidates.every(FederalElectionCandidate.is) &&
|
|
53
|
-
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member))
|
|
54
|
-
BallotpediaPerson.is(scout.ballotpedia_person));
|
|
42
|
+
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member)));
|
|
55
43
|
}
|
|
56
44
|
}
|
|
57
|
-
// const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
|
|
58
|
-
// export type ScoutOfficeID = typeof scout_office_ids[number]
|
|
59
|
-
// export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
|
|
60
|
-
// return scout_office_ids.includes(scout_office_id)
|
|
61
|
-
// }
|
|
62
|
-
// export class IndividualScout extends Scout {
|
|
63
|
-
// readonly office_id : ScoutOfficeID
|
|
64
|
-
// readonly state_id? : StateID
|
|
65
|
-
// readonly district? : number
|
|
66
|
-
// constructor(scout : any) {
|
|
67
|
-
// if (!IndividualScout.is(scout)) {
|
|
68
|
-
// throw Error("Invalid input.")
|
|
69
|
-
// }
|
|
70
|
-
// super(scout)
|
|
71
|
-
// this.office_id = scout.office_id
|
|
72
|
-
// this.state_id = scout.state_id
|
|
73
|
-
// this.district = scout.district
|
|
74
|
-
// }
|
|
75
|
-
// static is(scout : any) : scout is IndividualScout {
|
|
76
|
-
// return (
|
|
77
|
-
// Scout.is(scout) &&
|
|
78
|
-
// is_scout_office_id(scout.office_id) &&
|
|
79
|
-
// (scout.state_id === undefined || typeof scout.state_id === "string") &&
|
|
80
|
-
// (scout.district === undefined || typeof scout.district === "number")
|
|
81
|
-
// )
|
|
82
|
-
// }
|
|
83
|
-
// }
|
package/package.json
CHANGED
package/src/types/scout/Scout.ts
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import { BallotpediaPerson } from "../ballotpedia/BallotpediaPerson"
|
|
2
1
|
import { FederalCongressMember } from "../federal_congress/FederalCongressMember"
|
|
3
2
|
import { FederalElectionCandidate } from "../federal_elections/FederalElectionCandidate"
|
|
4
|
-
import { DocumentTypeID, is_document_type_id } from "../fragments/Fragment"
|
|
5
|
-
import { StateID } from "../regions/State"
|
|
6
|
-
|
|
7
|
-
// const scout_type_ids = ["I", "O"] as const
|
|
8
|
-
|
|
9
|
-
// export type ScoutTypeID = typeof scout_type_ids[number]
|
|
10
|
-
|
|
11
|
-
// export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
|
|
12
|
-
// return scout_type_ids.includes(scout_type_id)
|
|
13
|
-
// }
|
|
14
3
|
|
|
15
4
|
export class Scout {
|
|
16
5
|
readonly scout_id : string
|
|
17
|
-
|
|
18
|
-
// readonly name? : string
|
|
6
|
+
readonly name : string
|
|
19
7
|
readonly ballotpedia_person_id : number
|
|
20
8
|
// readonly wikipedia_article_id? : string
|
|
21
9
|
readonly s3_id_img? : string
|
|
@@ -26,8 +14,7 @@ export class Scout {
|
|
|
26
14
|
throw Error("Invalid input.")
|
|
27
15
|
}
|
|
28
16
|
this.scout_id = scout.scout_id
|
|
29
|
-
|
|
30
|
-
// this.name = scout.name
|
|
17
|
+
this.name = scout.name
|
|
31
18
|
this.ballotpedia_person_id = scout.ballotpedia_person_id
|
|
32
19
|
// this.wikipedia_article_id = scout.wikipedia_article_id
|
|
33
20
|
this.s3_id_img = scout.s3_id_img
|
|
@@ -37,9 +24,8 @@ export class Scout {
|
|
|
37
24
|
return (
|
|
38
25
|
scout !== undefined &&
|
|
39
26
|
typeof scout.scout_id === "string" &&
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
typeof scout.ballotpedia_person_id === "string" &&
|
|
27
|
+
typeof scout.name === "string" &&
|
|
28
|
+
typeof scout.ballotpedia_person_id === "number" &&
|
|
43
29
|
// (scout.wikipedia_article_id === undefined || typeof scout.wikipedia_article_id === "string") &&
|
|
44
30
|
(scout.s3_id_img === undefined || typeof scout.s3_id_img === "string")
|
|
45
31
|
)
|
|
@@ -49,7 +35,6 @@ export class Scout {
|
|
|
49
35
|
export class ScoutAux extends Scout {
|
|
50
36
|
readonly federal_election_candidates : FederalElectionCandidate[]
|
|
51
37
|
readonly federal_congress_member? : FederalCongressMember
|
|
52
|
-
readonly ballotpedia_person : BallotpediaPerson
|
|
53
38
|
|
|
54
39
|
constructor(scout : any) {
|
|
55
40
|
if (!ScoutAux.is(scout)) {
|
|
@@ -58,48 +43,13 @@ export class ScoutAux extends Scout {
|
|
|
58
43
|
super(scout)
|
|
59
44
|
this.federal_election_candidates = scout.federal_election_candidates
|
|
60
45
|
this.federal_congress_member = scout.federal_congress_member
|
|
61
|
-
this.ballotpedia_person = scout.ballotpedia_person
|
|
62
46
|
}
|
|
63
47
|
|
|
64
48
|
static is(scout : any) : scout is ScoutAux {
|
|
65
49
|
return (
|
|
66
50
|
Scout.is(scout) &&
|
|
67
51
|
Array.isArray(scout.federal_election_candidates) && scout.federal_election_candidates.every(FederalElectionCandidate.is) &&
|
|
68
|
-
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member))
|
|
69
|
-
BallotpediaPerson.is(scout.ballotpedia_person)
|
|
52
|
+
(scout.federal_congress_member === undefined || FederalCongressMember.is(scout.federal_congress_member))
|
|
70
53
|
)
|
|
71
54
|
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
|
|
75
|
-
|
|
76
|
-
// export type ScoutOfficeID = typeof scout_office_ids[number]
|
|
77
|
-
|
|
78
|
-
// export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
|
|
79
|
-
// return scout_office_ids.includes(scout_office_id)
|
|
80
|
-
// }
|
|
81
|
-
|
|
82
|
-
// export class IndividualScout extends Scout {
|
|
83
|
-
// readonly office_id : ScoutOfficeID
|
|
84
|
-
// readonly state_id? : StateID
|
|
85
|
-
// readonly district? : number
|
|
86
|
-
|
|
87
|
-
// constructor(scout : any) {
|
|
88
|
-
// if (!IndividualScout.is(scout)) {
|
|
89
|
-
// throw Error("Invalid input.")
|
|
90
|
-
// }
|
|
91
|
-
// super(scout)
|
|
92
|
-
// this.office_id = scout.office_id
|
|
93
|
-
// this.state_id = scout.state_id
|
|
94
|
-
// this.district = scout.district
|
|
95
|
-
// }
|
|
96
|
-
|
|
97
|
-
// static is(scout : any) : scout is IndividualScout {
|
|
98
|
-
// return (
|
|
99
|
-
// Scout.is(scout) &&
|
|
100
|
-
// is_scout_office_id(scout.office_id) &&
|
|
101
|
-
// (scout.state_id === undefined || typeof scout.state_id === "string") &&
|
|
102
|
-
// (scout.district === undefined || typeof scout.district === "number")
|
|
103
|
-
// )
|
|
104
|
-
// }
|
|
105
|
-
// }
|
|
55
|
+
}
|