Skip to content

Commit

Permalink
refactor: use a type union for OwidProcessingLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Oct 30, 2023
1 parent 0599d5f commit 615f0c0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion datapage/Datapage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const getDatapageDataV2 = async (
): Promise<DataPageDataV2> => {
{
const processingLevel =
variableMetadata.processingLevel ?? OwidProcessingLevel.minor
variableMetadata.processingLevel ?? "minor"
const lastUpdated = getLastUpdatedFromVariable(variableMetadata) ?? ""
const nextUpdate = getNextUpdateFromVariable(variableMetadata)
const datapageJson: DataPageDataV2 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface IndicatorKeyDataProps {
export const IndicatorKeyData = (props: IndicatorKeyDataProps) => {
const canonicalUrl = props.canonicalUrl ?? ""
const processedAdapted = getPhraseForProcessingLevel(
props.owidProcessingLevel ?? OwidProcessingLevel.minor
props.owidProcessingLevel ?? "minor"
)
const dateRange = getDateRange(props.dateRange)
const lastUpdated = dayjs(props.lastUpdated, ["YYYY", "YYYY-MM-DD"])
Expand Down
5 changes: 1 addition & 4 deletions packages/@ourworldindata/utils/src/OwidVariable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ export interface OwidVariablePresentation {
faqs?: FaqLink[]
}

export enum OwidProcessingLevel {
minor = "minor",
major = "major",
}
export type OwidProcessingLevel = 'minor' | 'major'

export interface FaqLink {
gdocId: string
Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ export {
type OwidVariablePresentation,
type OwidEntityKey,
type OwidLicense,
OwidProcessingLevel,
type OwidProcessingLevel,
} from "./OwidVariable.js"

export {
Expand Down

0 comments on commit 615f0c0

Please sign in to comment.