From d9a12be96099b984e518e82ad58ec3e61e90ffe3 Mon Sep 17 00:00:00 2001 From: repro Date: Mon, 5 Oct 2026 15:39:37 +0200 Subject: [PATCH 1/2] chore: generate types --- src/types/common/geographyItem.v1.d.ts | 7 ++- src/types/pathwayMetadata.v1.d.ts | 5 -- src/types/pathwayTimeseries.v1.d.ts | 85 +------------------------- 3 files changed, 6 insertions(+), 91 deletions(-) diff --git a/src/types/common/geographyItem.v1.d.ts b/src/types/common/geographyItem.v1.d.ts index 406b21bc..b8698bfe 100644 --- a/src/types/common/geographyItem.v1.d.ts +++ b/src/types/common/geographyItem.v1.d.ts @@ -7,7 +7,9 @@ /** * A single geography identifier used across schemas. Accepts 'Global', ISO-3166-1 alpha-2 country codes (e.g., 'US', 'DE'), or a set of region names (e.g., 'East Asia and Pacific', 'North America'). Any 2-letter items in the array will be treated as an ISO code. Any 2-letter entries that do not map to a country will throw errors (EU). Do not use full country names, only ISO alpha-2 codes. To avoid typographical errors, items may not be 3 letters long (USA) */ -export type GeographyItemV1 = +export type GeographyItemV1 = { + [k: string]: unknown; +} & ( | "Global" | "East Asia and Pacific" | "Europe and Central Asia" @@ -265,4 +267,5 @@ export type GeographyItemV1 = | "YT" | "ZA" | "ZM" - | "ZW"; + | "ZW" +); diff --git a/src/types/pathwayMetadata.v1.d.ts b/src/types/pathwayMetadata.v1.d.ts index 733c4e0c..77c1681c 100644 --- a/src/types/pathwayMetadata.v1.d.ts +++ b/src/types/pathwayMetadata.v1.d.ts @@ -86,8 +86,6 @@ export interface PathwayMetadataV1 { | "Other"; /** * Technologies applicable to this sector. - * - * Items: Display name of the technology as presented in charts or tables. */ technologies: ( | "Precision Agriculture" @@ -151,9 +149,6 @@ export interface PathwayMetadataV1 { * Expert recommendation for the pathway. */ expertOverview: string; - /** - * Items: Display name of the metric - */ metric: import("./common/metric.v1").MetricV1["displayName"][]; /** * Key features of the pathway. diff --git a/src/types/pathwayTimeseries.v1.d.ts b/src/types/pathwayTimeseries.v1.d.ts index bdfc64ba..08a4db6a 100644 --- a/src/types/pathwayTimeseries.v1.d.ts +++ b/src/types/pathwayTimeseries.v1.d.ts @@ -13,10 +13,6 @@ export type Publication = import("./common/publication.v1").PublicationV1; */ export type EmissionsScope = import("./common/emissionsScope.v1").EmissionsScopeV1; -/** - * Geographical area that the data covers. This should be a single string value: either 'Global', a country ISO-3166-1 alpha-2 code (e.g., 'US', 'DE'), or a free-text region name (e.g., 'North America', 'South East Asia'). Only 2-letter codes are accepted for countries; do not use full country names or 3-letter codes (e.g., 'USA' is not allowed). If a 2-letter code does not map to a country (e.g., 'EU'), it will result in an error. - */ -export type GeographyItem = import("./common/geographyItem.v1").GeographyItemV1; /** * A schema for the pathway timeseries dataset in TPR. @@ -52,85 +48,6 @@ export interface PathwayTimeseriesV1 { * Array of yearly data points for each sector, technology, and metric defined in this timeseries. */ data: { - /** - * Calendar year of the data point. - */ - year: number; - geography: GeographyItem; - /** - * Sector to which this data point belongs (must match one of the defined sectors). - */ - sector: - | "landUse" - | "agriculture" - | "buildings" - | "industry" - | "steel" - | "cement" - | "chemicals" - | "coalMining" - | "oilUpstream" - | "gasUpstream" - | "power" - | "automotive" - | "transport" - | "roadtransport" - | "aviation" - | "rail" - | "shipping" - | "other"; - /** - * Technology represented in this record (e.g., Solar, Wind, or null if sector-level only). - */ - technology: - | "precisionAgriculture" - | "agroforestry" - | "bioenergyCrops" - | "energyEfficiency" - | "smartGrids" - | "renewableHeating" - | "heatPumps" - | "buildingAutomation" - | "smartAppliances" - | "insulation" - | "carbonCaptureandStorage" - | "electrification" - | "processOptimization" - | "hydrogenUse" - | "coal" - | "oil" - | "gas" - | "wind" - | "solar" - | "nuclear" - | "biomass" - | "hydro" - | "renewables" - | "electricVehicles" - | "hydrogenVehicles" - | "biofuels" - | "publicTransport" - | "activeMobility" - | "aviationEfficiency" - | "maritimeEfficiency" - | "other" - | null; - /** - * Metric reported for this record (e.g., Capacity, Generation, Emissions Intensity). - */ - metric: - | "emissionsIntensity" - | "capacity" - | "generation" - | "technologyMix" - | "absoluteEmissions"; - /** - * Numeric value of the metric for the given year, sector, and technology. - */ - value: number; - /** - * Measurement unit associated with the metric value (e.g., GW, TWh, tCO2e). - */ - unit: "tCO2e/MWh" | "MtCO2e" | "GW" | "TWh" | "%"; + [k: string]: unknown; }[]; } From 8888b51a3fff4f8adc70a2280a242d69d0cfc3ba Mon Sep 17 00:00:00 2001 From: repro Date: Mon, 5 Oct 2026 15:49:35 +0200 Subject: [PATCH 2/2] more types --- src/types/common/geographyItem.v1.d.ts | 7 +-- src/types/pathwayMetadata.v1.d.ts | 5 ++ src/types/pathwayMetadata.v2.d.ts | 9 +++ src/types/pathwayTimeseries.v1.d.ts | 85 +++++++++++++++++++++++++- 4 files changed, 100 insertions(+), 6 deletions(-) diff --git a/src/types/common/geographyItem.v1.d.ts b/src/types/common/geographyItem.v1.d.ts index b8698bfe..406b21bc 100644 --- a/src/types/common/geographyItem.v1.d.ts +++ b/src/types/common/geographyItem.v1.d.ts @@ -7,9 +7,7 @@ /** * A single geography identifier used across schemas. Accepts 'Global', ISO-3166-1 alpha-2 country codes (e.g., 'US', 'DE'), or a set of region names (e.g., 'East Asia and Pacific', 'North America'). Any 2-letter items in the array will be treated as an ISO code. Any 2-letter entries that do not map to a country will throw errors (EU). Do not use full country names, only ISO alpha-2 codes. To avoid typographical errors, items may not be 3 letters long (USA) */ -export type GeographyItemV1 = { - [k: string]: unknown; -} & ( +export type GeographyItemV1 = | "Global" | "East Asia and Pacific" | "Europe and Central Asia" @@ -267,5 +265,4 @@ export type GeographyItemV1 = { | "YT" | "ZA" | "ZM" - | "ZW" -); + | "ZW"; diff --git a/src/types/pathwayMetadata.v1.d.ts b/src/types/pathwayMetadata.v1.d.ts index 77c1681c..733c4e0c 100644 --- a/src/types/pathwayMetadata.v1.d.ts +++ b/src/types/pathwayMetadata.v1.d.ts @@ -86,6 +86,8 @@ export interface PathwayMetadataV1 { | "Other"; /** * Technologies applicable to this sector. + * + * Items: Display name of the technology as presented in charts or tables. */ technologies: ( | "Precision Agriculture" @@ -149,6 +151,9 @@ export interface PathwayMetadataV1 { * Expert recommendation for the pathway. */ expertOverview: string; + /** + * Items: Display name of the metric + */ metric: import("./common/metric.v1").MetricV1["displayName"][]; /** * Key features of the pathway. diff --git a/src/types/pathwayMetadata.v2.d.ts b/src/types/pathwayMetadata.v2.d.ts index 8a64363a..4747c183 100644 --- a/src/types/pathwayMetadata.v2.d.ts +++ b/src/types/pathwayMetadata.v2.d.ts @@ -190,6 +190,8 @@ export interface PathwayMetadataV2 { | "Other"; /** * Technologies applicable to this sector. + * + * Items: Display name of the technology as presented in charts or tables. */ technologies: ( | "Precision Agriculture" @@ -246,6 +248,8 @@ export interface PathwayMetadataV2 { )[]; /** * Segments of this sector's value chain that the pathway covers -- it provides at least one relevant output metric for each. Members must be segments of this entry's `name`, enforced by scripts/schema-check-files.ts. + * + * Items: Display name of the sector segment as presented in tables. */ segments?: import("./common/sectorSegment.v1").SectorSegmentV1["displayName"][]; }[]; @@ -253,6 +257,9 @@ export interface PathwayMetadataV2 { * Narrative description of the pathway. Replaces v1's expertOverview: in the v1 corpus this is the '#### Pathway Description' section of it. v1's separate pathwayOverview field is retired without replacement, not merged in here -- the two texts restate each other, so merging them read as immediate self-repetition. null means no description is available. */ pathwayDescription: string | null; + /** + * Items: Display name of the metric + */ metric: import("./common/metric.v1").MetricV1["displayName"][]; /** * Key features of the pathway. Every field is an array of {sector, geography, value} entries (#858), so a pathway can hold different values for different parts of its coverage. A non-varying feature carries exactly one entry at the widest applicable scope: sector 'across sectors' for a multi-sector pathway else its lone sector, and geography 'Global' else the pathway's widest declared region or country. An entry that is absent at some scope means the resolver keeps broadening until it finds one; an explicit "No information" value is a real authored value that terminates that fallback chain and displays at its own scope. An empty array means nothing is authored at any scope. @@ -569,6 +576,8 @@ export interface PathwayMetadataV2 { * Segments of this row's sector that the metric covers. `Unspecified` where the pathway names none, `Not covered` where the sector-metric pair is not covered; either must then be the only member. Members must be segments of this row's `sector`, enforced by scripts/schema-check-files.ts. * * @minItems 1 + * + * Items: Display name of the sector segment as presented in tables. */ sectorSegment: [ import("./common/sectorSegment.v1").SectorSegmentV1["displayName"], diff --git a/src/types/pathwayTimeseries.v1.d.ts b/src/types/pathwayTimeseries.v1.d.ts index 08a4db6a..bdfc64ba 100644 --- a/src/types/pathwayTimeseries.v1.d.ts +++ b/src/types/pathwayTimeseries.v1.d.ts @@ -13,6 +13,10 @@ export type Publication = import("./common/publication.v1").PublicationV1; */ export type EmissionsScope = import("./common/emissionsScope.v1").EmissionsScopeV1; +/** + * Geographical area that the data covers. This should be a single string value: either 'Global', a country ISO-3166-1 alpha-2 code (e.g., 'US', 'DE'), or a free-text region name (e.g., 'North America', 'South East Asia'). Only 2-letter codes are accepted for countries; do not use full country names or 3-letter codes (e.g., 'USA' is not allowed). If a 2-letter code does not map to a country (e.g., 'EU'), it will result in an error. + */ +export type GeographyItem = import("./common/geographyItem.v1").GeographyItemV1; /** * A schema for the pathway timeseries dataset in TPR. @@ -48,6 +52,85 @@ export interface PathwayTimeseriesV1 { * Array of yearly data points for each sector, technology, and metric defined in this timeseries. */ data: { - [k: string]: unknown; + /** + * Calendar year of the data point. + */ + year: number; + geography: GeographyItem; + /** + * Sector to which this data point belongs (must match one of the defined sectors). + */ + sector: + | "landUse" + | "agriculture" + | "buildings" + | "industry" + | "steel" + | "cement" + | "chemicals" + | "coalMining" + | "oilUpstream" + | "gasUpstream" + | "power" + | "automotive" + | "transport" + | "roadtransport" + | "aviation" + | "rail" + | "shipping" + | "other"; + /** + * Technology represented in this record (e.g., Solar, Wind, or null if sector-level only). + */ + technology: + | "precisionAgriculture" + | "agroforestry" + | "bioenergyCrops" + | "energyEfficiency" + | "smartGrids" + | "renewableHeating" + | "heatPumps" + | "buildingAutomation" + | "smartAppliances" + | "insulation" + | "carbonCaptureandStorage" + | "electrification" + | "processOptimization" + | "hydrogenUse" + | "coal" + | "oil" + | "gas" + | "wind" + | "solar" + | "nuclear" + | "biomass" + | "hydro" + | "renewables" + | "electricVehicles" + | "hydrogenVehicles" + | "biofuels" + | "publicTransport" + | "activeMobility" + | "aviationEfficiency" + | "maritimeEfficiency" + | "other" + | null; + /** + * Metric reported for this record (e.g., Capacity, Generation, Emissions Intensity). + */ + metric: + | "emissionsIntensity" + | "capacity" + | "generation" + | "technologyMix" + | "absoluteEmissions"; + /** + * Numeric value of the metric for the given year, sector, and technology. + */ + value: number; + /** + * Measurement unit associated with the metric value (e.g., GW, TWh, tCO2e). + */ + unit: "tCO2e/MWh" | "MtCO2e" | "GW" | "TWh" | "%"; }[]; }