Skip to content

Commit

Permalink
style: add explicit return types
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Aug 20, 2024
1 parent efe7493 commit 29b9dc2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/@ourworldindata/utils/src/MultiDimDataPageConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ import {
import { groupBy, keyBy, pick } from "./Util.js"
import { Url } from "./urls/Url.js"

interface FilterToAvailableResult {
selectedChoices: MultiDimDimensionChoices
dimensionsWithAvailableChoices: Record<string, DimensionEnriched>
}

export class MultiDimDataPageConfig {
private constructor(
public readonly config: MultiDimDataPageConfigPreProcessed
) {}

static fromJson(jsonString: string) {
static fromJson(jsonString: string): MultiDimDataPageConfig {
return new MultiDimDataPageConfig(JSON.parse(jsonString))
}

static fromObject(obj: MultiDimDataPageConfigPreProcessed) {
static fromObject(
obj: MultiDimDataPageConfigPreProcessed
): MultiDimDataPageConfig {
return new MultiDimDataPageConfig(obj)
}

Expand Down Expand Up @@ -89,7 +96,9 @@ export class MultiDimDataPageConfig {
*
* - @marcelgerber, 2024-07-22
*/
filterToAvailableChoices(selectedChoices: MultiDimDimensionChoices) {
filterToAvailableChoices(
selectedChoices: MultiDimDimensionChoices
): FilterToAvailableResult {
const updatedSelectedChoices: MultiDimDimensionChoices = {}
const dimensionsWithAvailableChoices: Record<
string,
Expand Down Expand Up @@ -174,7 +183,7 @@ export class MultiDimDataPageConfig {
export const multiDimStateToQueryStr = (
grapherQueryParams: QueryParams,
dimensionChoices: MultiDimDimensionChoices
) => {
): string => {
return Url.fromQueryParams(grapherQueryParams).updateQueryParams(
dimensionChoices
).queryStr
Expand Down

0 comments on commit 29b9dc2

Please sign in to comment.