triangle-types 1.0.1 → 1.0.3
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,3 +1,4 @@
|
|
|
1
|
+
import { VoterScore } from "./VoterScore.js";
|
|
1
2
|
export declare class Voter {
|
|
2
3
|
readonly voter_id: string;
|
|
3
4
|
readonly state_id: string;
|
|
@@ -21,6 +22,12 @@ export declare class Voter {
|
|
|
21
22
|
readonly address_mail_city: string;
|
|
22
23
|
readonly address_mail_state_id: string;
|
|
23
24
|
readonly address_mail_zip: string;
|
|
25
|
+
readonly [x: string]: any;
|
|
26
|
+
constructor(voter: any);
|
|
27
|
+
static is(voter: any): voter is Voter;
|
|
28
|
+
}
|
|
29
|
+
export declare class VoterAux extends Voter {
|
|
30
|
+
readonly scores: VoterScore[];
|
|
24
31
|
constructor(voter: any);
|
|
25
32
|
static is(voter: any): voter is Voter;
|
|
26
33
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VoterScore } from "./VoterScore.js";
|
|
1
2
|
export class Voter {
|
|
2
3
|
voter_id;
|
|
3
4
|
state_id;
|
|
@@ -74,3 +75,17 @@ export class Voter {
|
|
|
74
75
|
typeof voter.address_mail_zip === "string");
|
|
75
76
|
}
|
|
76
77
|
}
|
|
78
|
+
export class VoterAux extends Voter {
|
|
79
|
+
scores;
|
|
80
|
+
constructor(voter) {
|
|
81
|
+
if (!VoterAux.is(voter)) {
|
|
82
|
+
throw Error("Invalid input.");
|
|
83
|
+
}
|
|
84
|
+
super(voter);
|
|
85
|
+
this.scores = voter.scores;
|
|
86
|
+
}
|
|
87
|
+
static is(voter) {
|
|
88
|
+
return (Voter.is(voter) &&
|
|
89
|
+
Array.isArray(voter.scores) && voter.scores.every(VoterScore.is));
|
|
90
|
+
}
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VoterScore } from "./VoterScore"
|
|
2
|
+
|
|
1
3
|
export class Voter {
|
|
2
4
|
readonly voter_id : string
|
|
3
5
|
readonly state_id : string
|
|
@@ -21,6 +23,7 @@ export class Voter {
|
|
|
21
23
|
readonly address_mail_city : string
|
|
22
24
|
readonly address_mail_state_id : string
|
|
23
25
|
readonly address_mail_zip : string
|
|
26
|
+
readonly [x : string] : any
|
|
24
27
|
|
|
25
28
|
constructor(voter : any) {
|
|
26
29
|
if (!Voter.is(voter)) {
|
|
@@ -77,4 +80,23 @@ export class Voter {
|
|
|
77
80
|
typeof voter.address_mail_zip === "string"
|
|
78
81
|
)
|
|
79
82
|
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export class VoterAux extends Voter {
|
|
86
|
+
readonly scores : VoterScore[]
|
|
87
|
+
|
|
88
|
+
constructor(voter : any) {
|
|
89
|
+
if (!VoterAux.is(voter)) {
|
|
90
|
+
throw Error("Invalid input.")
|
|
91
|
+
}
|
|
92
|
+
super(voter)
|
|
93
|
+
this.scores = voter.scores
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static is(voter : any) : voter is Voter {
|
|
97
|
+
return (
|
|
98
|
+
Voter.is(voter) &&
|
|
99
|
+
Array.isArray(voter.scores) && voter.scores.every(VoterScore.is)
|
|
100
|
+
)
|
|
101
|
+
}
|
|
80
102
|
}
|