triangle-types 1.0.266 → 1.0.267
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 +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/regions/County.d.ts +7 -0
- package/dist/src/types/regions/County.js +15 -5
- package/dist/src/types/regions/Municipality.d.ts +17 -0
- package/dist/src/types/regions/Municipality.js +41 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/regions/County.ts +22 -8
- package/src/types/regions/Municipality.ts +53 -0
package/dist/src/index.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ export * from "./types/prism/Voter.js";
|
|
|
74
74
|
export * from "./types/prism/VoterFeature.js";
|
|
75
75
|
export * from "./types/prism/VoterTarget.js";
|
|
76
76
|
export * from "./types/regions/County.js";
|
|
77
|
+
export * from "./types/regions/Municipality.js";
|
|
77
78
|
export * from "./types/regions/SchoolDistrict.js";
|
|
78
79
|
export * from "./types/regions/State.js";
|
|
79
80
|
export * from "./types/scout/Scout.js";
|
package/dist/src/index.js
CHANGED
|
@@ -74,6 +74,7 @@ export * from "./types/prism/Voter.js";
|
|
|
74
74
|
export * from "./types/prism/VoterFeature.js";
|
|
75
75
|
export * from "./types/prism/VoterTarget.js";
|
|
76
76
|
export * from "./types/regions/County.js";
|
|
77
|
+
export * from "./types/regions/Municipality.js";
|
|
77
78
|
export * from "./types/regions/SchoolDistrict.js";
|
|
78
79
|
export * from "./types/regions/State.js";
|
|
79
80
|
export * from "./types/scout/Scout.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FederalCensusCounty } from "../federal_census/FederalCensusCounty.js";
|
|
1
2
|
import { StateID } from "./State.js";
|
|
2
3
|
export declare class County {
|
|
3
4
|
readonly county_id: string;
|
|
@@ -6,6 +7,12 @@ export declare class County {
|
|
|
6
7
|
readonly function_type_id: string;
|
|
7
8
|
readonly name: string;
|
|
8
9
|
readonly federal_census_county_id: string;
|
|
10
|
+
readonly [x: string]: any;
|
|
9
11
|
constructor(county: any);
|
|
10
12
|
static is(county: any): county is County;
|
|
11
13
|
}
|
|
14
|
+
export declare class CountyAux extends County {
|
|
15
|
+
readonly federal_census_county: FederalCensusCounty;
|
|
16
|
+
constructor(county: CountyAux);
|
|
17
|
+
static is(county: any): county is CountyAux;
|
|
18
|
+
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { FederalCensusCounty } from "../federal_census/FederalCensusCounty.js";
|
|
2
2
|
import { is_state_id } from "./State.js";
|
|
3
|
-
// export type CountyTypeID = typeof county_type_ids[number]
|
|
4
|
-
// export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
|
|
5
|
-
// return county_type_ids.includes(county_type_id)
|
|
6
|
-
// }
|
|
7
3
|
export class County {
|
|
8
4
|
county_id;
|
|
9
5
|
state_id;
|
|
@@ -32,3 +28,17 @@ export class County {
|
|
|
32
28
|
typeof county.federal_census_county_id === "string");
|
|
33
29
|
}
|
|
34
30
|
}
|
|
31
|
+
export class CountyAux extends County {
|
|
32
|
+
federal_census_county;
|
|
33
|
+
constructor(county) {
|
|
34
|
+
if (!CountyAux.is(county)) {
|
|
35
|
+
throw Error("Invalid input.");
|
|
36
|
+
}
|
|
37
|
+
super(county);
|
|
38
|
+
this.federal_census_county = county.federal_census_county;
|
|
39
|
+
}
|
|
40
|
+
static is(county) {
|
|
41
|
+
return (County.is(county) &&
|
|
42
|
+
FederalCensusCounty.is(county.federal_census_county));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality.js";
|
|
2
|
+
import { StateID } from "./State.js";
|
|
3
|
+
export declare class Municipality {
|
|
4
|
+
readonly municipality_id: string;
|
|
5
|
+
readonly state_id: StateID;
|
|
6
|
+
readonly municipality_type_id?: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly federal_census_municipality_id: string;
|
|
9
|
+
readonly [x: string]: any;
|
|
10
|
+
constructor(municipality: any);
|
|
11
|
+
static is(municipality: any): municipality is Municipality;
|
|
12
|
+
}
|
|
13
|
+
export declare class MunicipalityAux extends Municipality {
|
|
14
|
+
readonly federal_census_municipality: FederalCensusMunicipality;
|
|
15
|
+
constructor(municipality: MunicipalityAux);
|
|
16
|
+
static is(municipality: any): municipality is MunicipalityAux;
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality.js";
|
|
2
|
+
import { is_state_id } from "./State.js";
|
|
3
|
+
export class Municipality {
|
|
4
|
+
municipality_id;
|
|
5
|
+
state_id;
|
|
6
|
+
municipality_type_id;
|
|
7
|
+
name;
|
|
8
|
+
federal_census_municipality_id;
|
|
9
|
+
constructor(municipality) {
|
|
10
|
+
if (!Municipality.is(municipality)) {
|
|
11
|
+
throw Error("Invalid input.");
|
|
12
|
+
}
|
|
13
|
+
this.municipality_id = municipality.municipality_id;
|
|
14
|
+
this.state_id = municipality.state_id;
|
|
15
|
+
this.municipality_type_id = municipality.municipality_type_id;
|
|
16
|
+
this.name = municipality.name;
|
|
17
|
+
this.federal_census_municipality_id = municipality.federal_census_municipality_id;
|
|
18
|
+
}
|
|
19
|
+
static is(municipality) {
|
|
20
|
+
return (municipality !== undefined &&
|
|
21
|
+
typeof municipality.municipality_id === "string" &&
|
|
22
|
+
is_state_id(municipality.state_id) &&
|
|
23
|
+
(municipality.municipality_type_id === undefined || typeof municipality.municipality_type_id === "string") &&
|
|
24
|
+
typeof municipality.name === "string" &&
|
|
25
|
+
typeof municipality.federal_census_municipality_id === "string");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export class MunicipalityAux extends Municipality {
|
|
29
|
+
federal_census_municipality;
|
|
30
|
+
constructor(municipality) {
|
|
31
|
+
if (!MunicipalityAux.is(municipality)) {
|
|
32
|
+
throw Error("Invalid input.");
|
|
33
|
+
}
|
|
34
|
+
super(municipality);
|
|
35
|
+
this.federal_census_municipality = municipality.federal_census_municipality;
|
|
36
|
+
}
|
|
37
|
+
static is(municipality) {
|
|
38
|
+
return (Municipality.is(municipality) &&
|
|
39
|
+
FederalCensusMunicipality.is(municipality.federal_census_municipality));
|
|
40
|
+
}
|
|
41
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -89,6 +89,7 @@ export * from "./types/prism/VoterFeature"
|
|
|
89
89
|
export * from "./types/prism/VoterTarget"
|
|
90
90
|
|
|
91
91
|
export * from "./types/regions/County"
|
|
92
|
+
export * from "./types/regions/Municipality"
|
|
92
93
|
export * from "./types/regions/SchoolDistrict"
|
|
93
94
|
export * from "./types/regions/State"
|
|
94
95
|
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { FederalCensusCounty } from "../federal_census/FederalCensusCounty"
|
|
3
2
|
import { is_state_id, StateID } from "./State"
|
|
4
3
|
|
|
5
|
-
// export type CountyTypeID = typeof county_type_ids[number]
|
|
6
|
-
|
|
7
|
-
// export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
|
|
8
|
-
// return county_type_ids.includes(county_type_id)
|
|
9
|
-
// }
|
|
10
|
-
|
|
11
4
|
export class County {
|
|
12
5
|
readonly county_id : string
|
|
13
6
|
readonly state_id : StateID
|
|
@@ -15,6 +8,7 @@ export class County {
|
|
|
15
8
|
readonly function_type_id : string
|
|
16
9
|
readonly name : string
|
|
17
10
|
readonly federal_census_county_id : string
|
|
11
|
+
readonly [x : string] : any
|
|
18
12
|
|
|
19
13
|
constructor(county : any) {
|
|
20
14
|
if (!County.is(county)) {
|
|
@@ -39,4 +33,24 @@ export class County {
|
|
|
39
33
|
typeof county.federal_census_county_id === "string"
|
|
40
34
|
)
|
|
41
35
|
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class CountyAux extends County {
|
|
39
|
+
readonly federal_census_county : FederalCensusCounty
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
constructor(county : CountyAux) {
|
|
43
|
+
if (!CountyAux.is(county)) {
|
|
44
|
+
throw Error("Invalid input.")
|
|
45
|
+
}
|
|
46
|
+
super(county)
|
|
47
|
+
this.federal_census_county = county.federal_census_county
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static is(county : any) : county is CountyAux {
|
|
51
|
+
return (
|
|
52
|
+
County.is(county) &&
|
|
53
|
+
FederalCensusCounty.is(county.federal_census_county)
|
|
54
|
+
)
|
|
55
|
+
}
|
|
42
56
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FederalCensusMunicipality } from "../federal_census/FederalCensusMunicipality"
|
|
2
|
+
import { is_state_id, StateID } from "./State"
|
|
3
|
+
|
|
4
|
+
export class Municipality {
|
|
5
|
+
readonly municipality_id : string
|
|
6
|
+
readonly state_id : StateID
|
|
7
|
+
readonly municipality_type_id? : string
|
|
8
|
+
readonly name : string
|
|
9
|
+
readonly federal_census_municipality_id : string
|
|
10
|
+
readonly [x : string] : any
|
|
11
|
+
|
|
12
|
+
constructor(municipality : any) {
|
|
13
|
+
if (!Municipality.is(municipality)) {
|
|
14
|
+
throw Error("Invalid input.")
|
|
15
|
+
}
|
|
16
|
+
this.municipality_id = municipality.municipality_id
|
|
17
|
+
this.state_id = municipality.state_id
|
|
18
|
+
this.municipality_type_id = municipality.municipality_type_id
|
|
19
|
+
this.name = municipality.name
|
|
20
|
+
this.federal_census_municipality_id = municipality.federal_census_municipality_id
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static is(municipality : any) : municipality is Municipality {
|
|
24
|
+
return (
|
|
25
|
+
municipality !== undefined &&
|
|
26
|
+
typeof municipality.municipality_id === "string" &&
|
|
27
|
+
is_state_id(municipality.state_id) &&
|
|
28
|
+
(municipality.municipality_type_id === undefined || typeof municipality.municipality_type_id === "string") &&
|
|
29
|
+
typeof municipality.name === "string" &&
|
|
30
|
+
typeof municipality.federal_census_municipality_id === "string"
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class MunicipalityAux extends Municipality {
|
|
36
|
+
readonly federal_census_municipality : FederalCensusMunicipality
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
constructor(municipality : MunicipalityAux) {
|
|
40
|
+
if (!MunicipalityAux.is(municipality)) {
|
|
41
|
+
throw Error("Invalid input.")
|
|
42
|
+
}
|
|
43
|
+
super(municipality)
|
|
44
|
+
this.federal_census_municipality = municipality.federal_census_municipality
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static is(municipality : any) : municipality is MunicipalityAux {
|
|
48
|
+
return (
|
|
49
|
+
Municipality.is(municipality) &&
|
|
50
|
+
FederalCensusMunicipality.is(municipality.federal_census_municipality)
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
}
|