triangle-types 1.0.100 → 1.0.101
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.
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +2 -1
- package/dist/src/types/prism/PrismFeature.d.ts +1 -0
- package/dist/src/types/prism/PrismFeature.js +4 -1
- package/dist/src/types/prism/Voter.d.ts +2 -2
- package/dist/src/types/prism/Voter.js +6 -5
- package/dist/src/types/prism/VoterFeature.d.ts +6 -4
- package/dist/src/types/prism/VoterFeature.js +8 -4
- package/dist/src/types/prism/VoterTurnout.d.ts +1 -15
- package/dist/src/types/prism/VoterTurnout.js +45 -42
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/types/prism/PrismFeature.ts +26 -0
- package/src/types/prism/Voter.ts +6 -5
- package/src/types/prism/VoterFeature.ts +44 -0
- package/src/types/prism/VoterTurnout.ts +44 -44
package/dist/src/index.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export * from "./types/fragments/FragmentVector.js";
|
|
|
49
49
|
export * from "./types/legistar/LegistarAgency.js";
|
|
50
50
|
export * from "./types/legistar/LegistarDocument.js";
|
|
51
51
|
export * from "./types/prism/Prism.js";
|
|
52
|
+
export * from "./types/prism/PrismFeature.js";
|
|
52
53
|
export * from "./types/prism/PrismMetric.js";
|
|
53
54
|
export * from "./types/prism/PrismSubPrism.js";
|
|
54
55
|
export * from "./types/prism/PrismSegment.js";
|
|
@@ -56,8 +57,8 @@ export * from "./types/prism/PrismTarget.js";
|
|
|
56
57
|
export * from "./types/prism/UserPrism.js";
|
|
57
58
|
export * from "./types/prism/UserPrismSegment.js";
|
|
58
59
|
export * from "./types/prism/Voter.js";
|
|
60
|
+
export * from "./types/prism/VoterFeature.js";
|
|
59
61
|
export * from "./types/prism/VoterTarget.js";
|
|
60
|
-
export * from "./types/prism/VoterTurnout.js";
|
|
61
62
|
export * from "./types/scout/Scout.js";
|
|
62
63
|
export * from "./types/scout/ScoutDocument.js";
|
|
63
64
|
export * from "./types/scout/ScoutSubScout.js";
|
package/dist/src/index.js
CHANGED
|
@@ -49,6 +49,7 @@ export * from "./types/fragments/FragmentVector.js";
|
|
|
49
49
|
export * from "./types/legistar/LegistarAgency.js";
|
|
50
50
|
export * from "./types/legistar/LegistarDocument.js";
|
|
51
51
|
export * from "./types/prism/Prism.js";
|
|
52
|
+
export * from "./types/prism/PrismFeature.js";
|
|
52
53
|
export * from "./types/prism/PrismMetric.js";
|
|
53
54
|
export * from "./types/prism/PrismSubPrism.js";
|
|
54
55
|
export * from "./types/prism/PrismSegment.js";
|
|
@@ -56,8 +57,8 @@ export * from "./types/prism/PrismTarget.js";
|
|
|
56
57
|
export * from "./types/prism/UserPrism.js";
|
|
57
58
|
export * from "./types/prism/UserPrismSegment.js";
|
|
58
59
|
export * from "./types/prism/Voter.js";
|
|
60
|
+
export * from "./types/prism/VoterFeature.js";
|
|
59
61
|
export * from "./types/prism/VoterTarget.js";
|
|
60
|
-
export * from "./types/prism/VoterTurnout.js";
|
|
61
62
|
export * from "./types/scout/Scout.js";
|
|
62
63
|
export * from "./types/scout/ScoutDocument.js";
|
|
63
64
|
export * from "./types/scout/ScoutSubScout.js";
|
|
@@ -2,6 +2,7 @@ export class PrismFeature {
|
|
|
2
2
|
prism_feature_id;
|
|
3
3
|
prism_id;
|
|
4
4
|
feature_id;
|
|
5
|
+
name;
|
|
5
6
|
constructor(prism_feature) {
|
|
6
7
|
if (!PrismFeature.is(prism_feature)) {
|
|
7
8
|
throw Error("Invalid input.");
|
|
@@ -9,11 +10,13 @@ export class PrismFeature {
|
|
|
9
10
|
this.prism_feature_id = prism_feature.prism_feature_id;
|
|
10
11
|
this.prism_id = prism_feature.prism_id;
|
|
11
12
|
this.feature_id = prism_feature.feature_id;
|
|
13
|
+
this.name = prism_feature.name;
|
|
12
14
|
}
|
|
13
15
|
static is(prism_feature) {
|
|
14
16
|
return (prism_feature !== undefined &&
|
|
15
17
|
typeof prism_feature.prism_feature_id === "string" &&
|
|
16
18
|
typeof prism_feature.prism_id === "string" &&
|
|
17
|
-
typeof prism_feature.feature_id === "string"
|
|
19
|
+
typeof prism_feature.feature_id === "string" &&
|
|
20
|
+
typeof prism_feature.name === "string");
|
|
18
21
|
}
|
|
19
22
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StateID } from "../State.js";
|
|
2
|
+
import { VoterFeature } from "./VoterFeature.js";
|
|
2
3
|
import { VoterTarget } from "./VoterTarget.js";
|
|
3
|
-
import { VoterTurnout } from "./VoterTurnout.js";
|
|
4
4
|
export declare const voter_party_type_ids: readonly ["D", "R", "I"];
|
|
5
5
|
export type VoterPartyTypeID = typeof voter_party_type_ids[number];
|
|
6
6
|
export declare function is_voter_party_type_id(voter_party_type_id: any): voter_party_type_id is VoterPartyTypeID;
|
|
@@ -48,8 +48,8 @@ export declare class Voter {
|
|
|
48
48
|
static is(voter: any): voter is Voter;
|
|
49
49
|
}
|
|
50
50
|
export declare class VoterAux extends Voter {
|
|
51
|
+
readonly features: VoterFeature[];
|
|
51
52
|
readonly targets: VoterTarget[];
|
|
52
|
-
readonly turnouts: VoterTurnout[];
|
|
53
53
|
constructor(voter: any);
|
|
54
54
|
static is(voter: any): voter is Voter;
|
|
55
55
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { is_state_id } from "../State.js";
|
|
2
|
+
import { VoterFeature } from "./VoterFeature.js";
|
|
2
3
|
import { VoterTarget } from "./VoterTarget.js";
|
|
3
|
-
import { VoterTurnout } from "./VoterTurnout.js";
|
|
4
4
|
export const voter_party_type_ids = ["D", "R", "I"];
|
|
5
5
|
export function is_voter_party_type_id(voter_party_type_id) {
|
|
6
6
|
return voter_party_type_ids.includes(voter_party_type_id);
|
|
@@ -130,19 +130,20 @@ export class Voter {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
export class VoterAux extends Voter {
|
|
133
|
+
features;
|
|
133
134
|
targets;
|
|
134
|
-
turnouts
|
|
135
|
+
// readonly turnouts : VoterTurnout[]
|
|
135
136
|
constructor(voter) {
|
|
136
137
|
if (!VoterAux.is(voter)) {
|
|
137
138
|
throw Error("Invalid input.");
|
|
138
139
|
}
|
|
139
140
|
super(voter);
|
|
141
|
+
this.features = voter.features;
|
|
140
142
|
this.targets = voter.targets;
|
|
141
|
-
this.turnouts = voter.turnouts;
|
|
142
143
|
}
|
|
143
144
|
static is(voter) {
|
|
144
145
|
return (Voter.is(voter) &&
|
|
145
|
-
Array.isArray(voter.
|
|
146
|
-
Array.isArray(voter.
|
|
146
|
+
Array.isArray(voter.features) && voter.features.every(VoterFeature.is) &&
|
|
147
|
+
Array.isArray(voter.targets) && voter.targets.every(VoterTarget.is));
|
|
147
148
|
}
|
|
148
149
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { StateID } from "../State.js";
|
|
2
|
+
import { VoterPartyTypeID } from "./Voter.js";
|
|
2
3
|
export declare class VoterFeature {
|
|
3
4
|
readonly voter_feature_id: string;
|
|
4
5
|
readonly voter_id: string;
|
|
5
6
|
readonly feature_id: string;
|
|
6
|
-
readonly value:
|
|
7
|
+
readonly value: string;
|
|
7
8
|
readonly state_id: StateID;
|
|
8
|
-
readonly federal_congress_district_id
|
|
9
|
-
readonly state_legislature_house_district_id
|
|
10
|
-
readonly state_legislature_senate_district_id
|
|
9
|
+
readonly federal_congress_district_id?: string;
|
|
10
|
+
readonly state_legislature_house_district_id?: string;
|
|
11
|
+
readonly state_legislature_senate_district_id?: string;
|
|
12
|
+
readonly party_type_id: VoterPartyTypeID;
|
|
11
13
|
constructor(voter_feature: any);
|
|
12
14
|
static is(voter_feature: any): voter_feature is VoterFeature;
|
|
13
15
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { is_state_id } from "../State.js";
|
|
2
|
+
import { is_voter_party_type_id } from "./Voter.js";
|
|
2
3
|
export class VoterFeature {
|
|
3
4
|
voter_feature_id;
|
|
4
5
|
voter_id;
|
|
@@ -8,6 +9,7 @@ export class VoterFeature {
|
|
|
8
9
|
federal_congress_district_id;
|
|
9
10
|
state_legislature_house_district_id;
|
|
10
11
|
state_legislature_senate_district_id;
|
|
12
|
+
party_type_id;
|
|
11
13
|
constructor(voter_feature) {
|
|
12
14
|
if (!VoterFeature.is(voter_feature)) {
|
|
13
15
|
throw Error("Invalid input.");
|
|
@@ -20,16 +22,18 @@ export class VoterFeature {
|
|
|
20
22
|
this.federal_congress_district_id = voter_feature.federal_congress_district_id;
|
|
21
23
|
this.state_legislature_house_district_id = voter_feature.state_legislature_house_district_id;
|
|
22
24
|
this.state_legislature_senate_district_id = voter_feature.state_legislature_senate_district_id;
|
|
25
|
+
this.party_type_id = voter_feature.party_type_id;
|
|
23
26
|
}
|
|
24
27
|
static is(voter_feature) {
|
|
25
28
|
return (voter_feature !== undefined &&
|
|
26
29
|
typeof voter_feature.voter_feature_id === "string" &&
|
|
27
30
|
typeof voter_feature.voter_id === "string" &&
|
|
28
31
|
typeof voter_feature.feature_id === "string" &&
|
|
29
|
-
typeof voter_feature.value === "
|
|
32
|
+
typeof voter_feature.value === "string" &&
|
|
30
33
|
is_state_id(voter_feature.state_id) &&
|
|
31
|
-
typeof voter_feature.federal_congress_district_id === "string" &&
|
|
32
|
-
typeof voter_feature.state_legislature_house_district_id === "string" &&
|
|
33
|
-
typeof voter_feature.state_legislature_senate_district_id === "string")
|
|
34
|
+
(voter_feature.federal_congress_district_id === undefined || typeof voter_feature.federal_congress_district_id === "string") &&
|
|
35
|
+
(voter_feature.state_legislature_house_district_id === undefined || typeof voter_feature.state_legislature_house_district_id === "string") &&
|
|
36
|
+
(voter_feature.state_legislature_senate_district_id === undefined || typeof voter_feature.state_legislature_senate_district_id === "string") &&
|
|
37
|
+
is_voter_party_type_id(voter_feature.party_type_id));
|
|
34
38
|
}
|
|
35
39
|
}
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare class VoterTurnout {
|
|
3
|
-
readonly voter_turnout_id: string;
|
|
4
|
-
readonly voter_id: string;
|
|
5
|
-
readonly turnout_id: string;
|
|
6
|
-
readonly year: number;
|
|
7
|
-
readonly turnout_type_id: string;
|
|
8
|
-
readonly value: boolean;
|
|
9
|
-
readonly state_id: StateID;
|
|
10
|
-
readonly federal_congress_district_id: string;
|
|
11
|
-
readonly state_legislature_house_district_id: string;
|
|
12
|
-
readonly state_legislature_senate_district_id: string;
|
|
13
|
-
constructor(voter_turnout: any);
|
|
14
|
-
static is(voter_turnout: any): voter_turnout is VoterTurnout;
|
|
15
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,42 +1,45 @@
|
|
|
1
|
-
import { is_state_id } from "../State.js"
|
|
2
|
-
export
|
|
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
|
-
|
|
1
|
+
// import { is_state_id, StateID } from "../State.js"
|
|
2
|
+
export {};
|
|
3
|
+
// export class VoterTurnout {
|
|
4
|
+
// readonly voter_turnout_id : string
|
|
5
|
+
// readonly voter_id : string
|
|
6
|
+
// readonly turnout_id : string
|
|
7
|
+
// readonly year : number
|
|
8
|
+
// readonly turnout_type_id : string
|
|
9
|
+
// readonly value : boolean
|
|
10
|
+
// readonly state_id : StateID
|
|
11
|
+
// readonly federal_congress_district_id : string
|
|
12
|
+
// readonly state_legislature_house_district_id : string
|
|
13
|
+
// readonly state_legislature_senate_district_id : string
|
|
14
|
+
// constructor(voter_turnout : any) {
|
|
15
|
+
// if (!VoterTurnout.is(voter_turnout)) {
|
|
16
|
+
// throw Error("Invalid input.")
|
|
17
|
+
// }
|
|
18
|
+
// this.voter_turnout_id = voter_turnout.voter_turnout_id
|
|
19
|
+
// this.voter_id = voter_turnout.voter_id
|
|
20
|
+
// this.turnout_id = voter_turnout.turnout_id
|
|
21
|
+
// this.year = voter_turnout.year
|
|
22
|
+
// this.turnout_type_id = voter_turnout.turnout_type_id
|
|
23
|
+
// this.value = voter_turnout.value
|
|
24
|
+
// this.state_id = voter_turnout.state_id
|
|
25
|
+
// this.state_id = voter_turnout.state_id
|
|
26
|
+
// this.federal_congress_district_id = voter_turnout.federal_congress_district_id
|
|
27
|
+
// this.state_legislature_house_district_id = voter_turnout.state_legislature_house_district_id
|
|
28
|
+
// this.state_legislature_senate_district_id = voter_turnout.state_legislature_senate_district_id
|
|
29
|
+
// }
|
|
30
|
+
// static is(voter_turnout : any) : voter_turnout is VoterTurnout {
|
|
31
|
+
// return (
|
|
32
|
+
// voter_turnout !== undefined &&
|
|
33
|
+
// typeof voter_turnout.voter_turnout_id === "string" &&
|
|
34
|
+
// typeof voter_turnout.voter_id === "string" &&
|
|
35
|
+
// typeof voter_turnout.turnout_id === "string" &&
|
|
36
|
+
// typeof voter_turnout.year === "number"&&
|
|
37
|
+
// typeof voter_turnout.turnout_type_id === "string" &&
|
|
38
|
+
// typeof voter_turnout.value === "boolean" &&
|
|
39
|
+
// is_state_id(voter_turnout.state_id) &&
|
|
40
|
+
// typeof voter_turnout.federal_congress_district_id === "string" &&
|
|
41
|
+
// typeof voter_turnout.state_legislature_house_district_id === "string" &&
|
|
42
|
+
// typeof voter_turnout.state_legislature_senate_district_id === "string"
|
|
43
|
+
// )
|
|
44
|
+
// }
|
|
45
|
+
// }
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -59,6 +59,7 @@ export * from "./types/legistar/LegistarAgency"
|
|
|
59
59
|
export * from "./types/legistar/LegistarDocument"
|
|
60
60
|
|
|
61
61
|
export * from "./types/prism/Prism"
|
|
62
|
+
export * from "./types/prism/PrismFeature"
|
|
62
63
|
export * from "./types/prism/PrismMetric"
|
|
63
64
|
export * from "./types/prism/PrismSubPrism"
|
|
64
65
|
export * from "./types/prism/PrismSegment"
|
|
@@ -66,8 +67,8 @@ export * from "./types/prism/PrismTarget"
|
|
|
66
67
|
export * from "./types/prism/UserPrism"
|
|
67
68
|
export * from "./types/prism/UserPrismSegment"
|
|
68
69
|
export * from "./types/prism/Voter"
|
|
70
|
+
export * from "./types/prism/VoterFeature"
|
|
69
71
|
export * from "./types/prism/VoterTarget"
|
|
70
|
-
export * from "./types/prism/VoterTurnout"
|
|
71
72
|
|
|
72
73
|
export * from "./types/scout/Scout"
|
|
73
74
|
export * from "./types/scout/ScoutDocument"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class PrismFeature {
|
|
2
|
+
readonly prism_feature_id : string
|
|
3
|
+
readonly prism_id : string
|
|
4
|
+
readonly feature_id : string
|
|
5
|
+
readonly name : string
|
|
6
|
+
|
|
7
|
+
constructor(prism_feature : any) {
|
|
8
|
+
if (!PrismFeature.is(prism_feature)) {
|
|
9
|
+
throw Error("Invalid input.")
|
|
10
|
+
}
|
|
11
|
+
this.prism_feature_id = prism_feature.prism_feature_id
|
|
12
|
+
this.prism_id = prism_feature.prism_id
|
|
13
|
+
this.feature_id = prism_feature.feature_id
|
|
14
|
+
this.name = prism_feature.name
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static is(prism_feature : any) : prism_feature is PrismFeature {
|
|
18
|
+
return (
|
|
19
|
+
prism_feature !== undefined &&
|
|
20
|
+
typeof prism_feature.prism_feature_id === "string" &&
|
|
21
|
+
typeof prism_feature.prism_id === "string" &&
|
|
22
|
+
typeof prism_feature.feature_id === "string" &&
|
|
23
|
+
typeof prism_feature.name === "string"
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/types/prism/Voter.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { is_state_id, StateID } from "../State"
|
|
2
|
+
import { VoterFeature } from "./VoterFeature"
|
|
2
3
|
import { VoterTarget } from "./VoterTarget"
|
|
3
|
-
import { VoterTurnout } from "./VoterTurnout"
|
|
4
4
|
|
|
5
5
|
export const voter_party_type_ids = ["D", "R", "I"] as const
|
|
6
6
|
|
|
@@ -141,23 +141,24 @@ export class Voter {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
export class VoterAux extends Voter {
|
|
144
|
+
readonly features : VoterFeature[]
|
|
144
145
|
readonly targets : VoterTarget[]
|
|
145
|
-
readonly turnouts : VoterTurnout[]
|
|
146
|
+
// readonly turnouts : VoterTurnout[]
|
|
146
147
|
|
|
147
148
|
constructor(voter : any) {
|
|
148
149
|
if (!VoterAux.is(voter)) {
|
|
149
150
|
throw Error("Invalid input.")
|
|
150
151
|
}
|
|
151
152
|
super(voter)
|
|
153
|
+
this.features = voter.features
|
|
152
154
|
this.targets = voter.targets
|
|
153
|
-
this.turnouts = voter.turnouts
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
static is(voter : any) : voter is Voter {
|
|
157
158
|
return (
|
|
158
159
|
Voter.is(voter) &&
|
|
159
|
-
Array.isArray(voter.
|
|
160
|
-
Array.isArray(voter.
|
|
160
|
+
Array.isArray(voter.features) && voter.features.every(VoterFeature.is) &&
|
|
161
|
+
Array.isArray(voter.targets) && voter.targets.every(VoterTarget.is)
|
|
161
162
|
)
|
|
162
163
|
}
|
|
163
164
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
|
|
3
|
+
|
|
4
|
+
export class VoterFeature {
|
|
5
|
+
readonly voter_feature_id : string
|
|
6
|
+
readonly voter_id : string
|
|
7
|
+
readonly feature_id : string
|
|
8
|
+
readonly value : string
|
|
9
|
+
readonly state_id : StateID
|
|
10
|
+
readonly federal_congress_district_id? : string
|
|
11
|
+
readonly state_legislature_house_district_id? : string
|
|
12
|
+
readonly state_legislature_senate_district_id? : string
|
|
13
|
+
readonly party_type_id : VoterPartyTypeID
|
|
14
|
+
|
|
15
|
+
constructor(voter_feature : any) {
|
|
16
|
+
if (!VoterFeature.is(voter_feature)) {
|
|
17
|
+
throw Error("Invalid input.")
|
|
18
|
+
}
|
|
19
|
+
this.voter_feature_id = voter_feature.voter_feature_id
|
|
20
|
+
this.voter_id = voter_feature.voter_id
|
|
21
|
+
this.feature_id = voter_feature.feature_id
|
|
22
|
+
this.value = voter_feature.value
|
|
23
|
+
this.state_id = voter_feature.state_id
|
|
24
|
+
this.federal_congress_district_id = voter_feature.federal_congress_district_id
|
|
25
|
+
this.state_legislature_house_district_id = voter_feature.state_legislature_house_district_id
|
|
26
|
+
this.state_legislature_senate_district_id = voter_feature.state_legislature_senate_district_id
|
|
27
|
+
this.party_type_id = voter_feature.party_type_id
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static is(voter_feature : any) : voter_feature is VoterFeature {
|
|
31
|
+
return (
|
|
32
|
+
voter_feature !== undefined &&
|
|
33
|
+
typeof voter_feature.voter_feature_id === "string" &&
|
|
34
|
+
typeof voter_feature.voter_id === "string" &&
|
|
35
|
+
typeof voter_feature.feature_id === "string" &&
|
|
36
|
+
typeof voter_feature.value === "string" &&
|
|
37
|
+
is_state_id(voter_feature.state_id) &&
|
|
38
|
+
(voter_feature.federal_congress_district_id === undefined || typeof voter_feature.federal_congress_district_id === "string") &&
|
|
39
|
+
(voter_feature.state_legislature_house_district_id === undefined || typeof voter_feature.state_legislature_house_district_id === "string") &&
|
|
40
|
+
(voter_feature.state_legislature_senate_district_id === undefined || typeof voter_feature.state_legislature_senate_district_id === "string") &&
|
|
41
|
+
is_voter_party_type_id(voter_feature.party_type_id)
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { is_state_id, StateID } from "../State"
|
|
1
|
+
// import { is_state_id, StateID } from "../State"
|
|
2
2
|
|
|
3
|
-
export class VoterTurnout {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
// export class VoterTurnout {
|
|
4
|
+
// readonly voter_turnout_id : string
|
|
5
|
+
// readonly voter_id : string
|
|
6
|
+
// readonly turnout_id : string
|
|
7
|
+
// readonly year : number
|
|
8
|
+
// readonly turnout_type_id : string
|
|
9
|
+
// readonly value : boolean
|
|
10
|
+
// readonly state_id : StateID
|
|
11
|
+
// readonly federal_congress_district_id : string
|
|
12
|
+
// readonly state_legislature_house_district_id : string
|
|
13
|
+
// readonly state_legislature_senate_district_id : string
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
// constructor(voter_turnout : any) {
|
|
16
|
+
// if (!VoterTurnout.is(voter_turnout)) {
|
|
17
|
+
// throw Error("Invalid input.")
|
|
18
|
+
// }
|
|
19
|
+
// this.voter_turnout_id = voter_turnout.voter_turnout_id
|
|
20
|
+
// this.voter_id = voter_turnout.voter_id
|
|
21
|
+
// this.turnout_id = voter_turnout.turnout_id
|
|
22
|
+
// this.year = voter_turnout.year
|
|
23
|
+
// this.turnout_type_id = voter_turnout.turnout_type_id
|
|
24
|
+
// this.value = voter_turnout.value
|
|
25
|
+
// this.state_id = voter_turnout.state_id
|
|
26
|
+
// this.state_id = voter_turnout.state_id
|
|
27
|
+
// this.federal_congress_district_id = voter_turnout.federal_congress_district_id
|
|
28
|
+
// this.state_legislature_house_district_id = voter_turnout.state_legislature_house_district_id
|
|
29
|
+
// this.state_legislature_senate_district_id = voter_turnout.state_legislature_senate_district_id
|
|
30
|
+
// }
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
32
|
+
// static is(voter_turnout : any) : voter_turnout is VoterTurnout {
|
|
33
|
+
// return (
|
|
34
|
+
// voter_turnout !== undefined &&
|
|
35
|
+
// typeof voter_turnout.voter_turnout_id === "string" &&
|
|
36
|
+
// typeof voter_turnout.voter_id === "string" &&
|
|
37
|
+
// typeof voter_turnout.turnout_id === "string" &&
|
|
38
|
+
// typeof voter_turnout.year === "number"&&
|
|
39
|
+
// typeof voter_turnout.turnout_type_id === "string" &&
|
|
40
|
+
// typeof voter_turnout.value === "boolean" &&
|
|
41
|
+
// is_state_id(voter_turnout.state_id) &&
|
|
42
|
+
// typeof voter_turnout.federal_congress_district_id === "string" &&
|
|
43
|
+
// typeof voter_turnout.state_legislature_house_district_id === "string" &&
|
|
44
|
+
// typeof voter_turnout.state_legislature_senate_district_id === "string"
|
|
45
|
+
// )
|
|
46
|
+
// }
|
|
47
|
+
// }
|