triangle-types 1.0.82 → 1.0.83
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,6 +1,9 @@
|
|
|
1
1
|
import { StateID } from "../State.js";
|
|
2
2
|
import { VoterTarget } from "./VoterTarget.js";
|
|
3
3
|
import { VoterTurnout } from "./VoterTurnout.js";
|
|
4
|
+
declare const voter_party_type_ids: readonly ["D", "R", "I"];
|
|
5
|
+
export type VoterPartyTypeID = typeof voter_party_type_ids[number];
|
|
6
|
+
export declare function is_voter_party_type_id(voter_party_type_id: any): voter_party_type_id is VoterPartyTypeID;
|
|
4
7
|
export declare class Voter {
|
|
5
8
|
readonly voter_id: string;
|
|
6
9
|
readonly state_id: StateID;
|
|
@@ -36,6 +39,7 @@ export declare class Voter {
|
|
|
36
39
|
readonly ethnic_description?: string;
|
|
37
40
|
readonly religion_description?: string;
|
|
38
41
|
readonly party_description?: string;
|
|
42
|
+
readonly party_type_id?: VoterPartyTypeID;
|
|
39
43
|
readonly language?: string;
|
|
40
44
|
readonly education_level?: string;
|
|
41
45
|
readonly marital_status?: string;
|
|
@@ -49,3 +53,4 @@ export declare class VoterAux extends Voter {
|
|
|
49
53
|
constructor(voter: any);
|
|
50
54
|
static is(voter: any): voter is Voter;
|
|
51
55
|
}
|
|
56
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { is_state_id } from "../State.js";
|
|
2
2
|
import { VoterTarget } from "./VoterTarget.js";
|
|
3
3
|
import { VoterTurnout } from "./VoterTurnout.js";
|
|
4
|
+
const voter_party_type_ids = ["D", "R", "I"];
|
|
5
|
+
export function is_voter_party_type_id(voter_party_type_id) {
|
|
6
|
+
return voter_party_type_ids.includes(voter_party_type_id);
|
|
7
|
+
}
|
|
4
8
|
export class Voter {
|
|
5
9
|
voter_id;
|
|
6
10
|
state_id;
|
|
@@ -36,6 +40,7 @@ export class Voter {
|
|
|
36
40
|
ethnic_description;
|
|
37
41
|
religion_description;
|
|
38
42
|
party_description;
|
|
43
|
+
party_type_id;
|
|
39
44
|
language;
|
|
40
45
|
education_level;
|
|
41
46
|
marital_status;
|
|
@@ -77,6 +82,7 @@ export class Voter {
|
|
|
77
82
|
this.ethnic_description = voter.ethnic_description;
|
|
78
83
|
this.religion_description = voter.religion_description;
|
|
79
84
|
this.party_description = voter.party_description;
|
|
85
|
+
this.party_type_id = voter.party_type_id;
|
|
80
86
|
this.language = voter.language;
|
|
81
87
|
this.education_level = voter.education_level;
|
|
82
88
|
this.marital_status = voter.marital_status;
|
|
@@ -117,6 +123,7 @@ export class Voter {
|
|
|
117
123
|
(voter.ethnic_description === undefined || typeof voter.ethnic_description === "string") &&
|
|
118
124
|
(voter.religion_description === undefined || typeof voter.religion_description === "string") &&
|
|
119
125
|
(voter.party_description === undefined || typeof voter.party_description === "string") &&
|
|
126
|
+
(voter.party_type_id === undefined || is_voter_party_type_id(voter.party_type_id)) &&
|
|
120
127
|
(voter.language === undefined || typeof voter.language === "string") &&
|
|
121
128
|
(voter.education_level === undefined || typeof voter.education_level === "string") &&
|
|
122
129
|
(voter.marital_status === undefined || typeof voter.marital_status === "string"));
|
package/package.json
CHANGED
package/src/types/prism/Voter.ts
CHANGED
|
@@ -2,6 +2,14 @@ import { is_state_id, StateID } from "../State"
|
|
|
2
2
|
import { VoterTarget } from "./VoterTarget"
|
|
3
3
|
import { VoterTurnout } from "./VoterTurnout"
|
|
4
4
|
|
|
5
|
+
const voter_party_type_ids = ["D", "R", "I"] as const
|
|
6
|
+
|
|
7
|
+
export type VoterPartyTypeID = typeof voter_party_type_ids[number]
|
|
8
|
+
|
|
9
|
+
export function is_voter_party_type_id(voter_party_type_id : any) : voter_party_type_id is VoterPartyTypeID {
|
|
10
|
+
return voter_party_type_ids.includes(voter_party_type_id)
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
export class Voter {
|
|
6
14
|
readonly voter_id : string
|
|
7
15
|
readonly state_id : StateID
|
|
@@ -37,6 +45,7 @@ export class Voter {
|
|
|
37
45
|
readonly ethnic_description? : string
|
|
38
46
|
readonly religion_description? : string
|
|
39
47
|
readonly party_description? : string
|
|
48
|
+
readonly party_type_id? : VoterPartyTypeID
|
|
40
49
|
readonly language? : string
|
|
41
50
|
readonly education_level? : string
|
|
42
51
|
readonly marital_status? : string
|
|
@@ -80,6 +89,7 @@ export class Voter {
|
|
|
80
89
|
this.ethnic_description = voter.ethnic_description
|
|
81
90
|
this.religion_description = voter.religion_description
|
|
82
91
|
this.party_description = voter.party_description
|
|
92
|
+
this.party_type_id = voter.party_type_id
|
|
83
93
|
this.language = voter.language
|
|
84
94
|
this.education_level = voter.education_level
|
|
85
95
|
this.marital_status = voter.marital_status
|
|
@@ -122,6 +132,7 @@ export class Voter {
|
|
|
122
132
|
(voter.ethnic_description === undefined || typeof voter.ethnic_description === "string") &&
|
|
123
133
|
(voter.religion_description === undefined || typeof voter.religion_description === "string") &&
|
|
124
134
|
(voter.party_description === undefined || typeof voter.party_description === "string") &&
|
|
135
|
+
(voter.party_type_id === undefined || is_voter_party_type_id(voter.party_type_id)) &&
|
|
125
136
|
(voter.language === undefined || typeof voter.language === "string") &&
|
|
126
137
|
(voter.education_level === undefined || typeof voter.education_level === "string") &&
|
|
127
138
|
(voter.marital_status === undefined || typeof voter.marital_status === "string")
|