Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ts and fix some polymorphic code. and by fix I mean lie to compiler #927

Merged
merged 1 commit into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 75 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"axios": "0.21.2",
"body-parser": "1.18.2",
"chronoshift": "0.9.6",
"commander": "9.4.1",
"compression": "1.7.1",
"core-js": "2.6.0",
"d3": "4.13.0",
Expand Down Expand Up @@ -194,7 +195,7 @@
"tslint-eslint-rules": "5.3.1",
"tslint-no-focused-test": "0.5.0",
"tslint-react": "3.6.0",
"typescript": "3.3.1",
"typescript": "3.4.1",
"webpack": "4.41.5",
"webpack-cli": "3.3.10",
"webpack-dev-middleware": "3.7.2",
Expand Down
12 changes: 7 additions & 5 deletions src/client/components/vis-selector/vis-selector-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import React from "react";
import { VisualizationManifest } from "../../../common/models/visualization-manifest/visualization-manifest";
import { VisualizationSettings } from "../../../common/models/visualization-settings/visualization-settings";
import { Binary } from "../../../common/utils/functional/functional";
import { Binary, Unary } from "../../../common/utils/functional/functional";
import { Fn } from "../../../common/utils/general/general";
import { ImmutableRecord } from "../../../common/utils/immutable-utils/immutable-utils";
import { MANIFESTS } from "../../../common/visualization-manifests";
Expand Down Expand Up @@ -85,7 +85,8 @@ export class VisSelectorMenu extends React.Component<VisSelectorMenuProps, VisSe
switch (visualization.name) {
case "table":
const TableSettingsComponent = settingsComponent(visualization.name);
return <TableSettingsComponent onChange={this.changeSettings} settings={visualizationSettings as ImmutableRecord<TableSettings>} />;
return <TableSettingsComponent onChange={this.changeSettings as Unary<ImmutableRecord<TableSettings>, void>}
settings={visualizationSettings as ImmutableRecord<TableSettings>} />;
case "grid":
return null;
case "heatmap":
Expand All @@ -96,11 +97,12 @@ export class VisSelectorMenu extends React.Component<VisSelectorMenuProps, VisSe
return null;
case "line-chart":
const LineChartSettingsComponent = settingsComponent(visualization.name);
return <LineChartSettingsComponent onChange={this.changeSettings} settings={visualizationSettings as ImmutableRecord<LineChartSettings>}/>;
return <LineChartSettingsComponent onChange={this.changeSettings as Unary<ImmutableRecord<LineChartSettings>, void>}
settings={visualizationSettings as ImmutableRecord<LineChartSettings>}/>;
case "scatterplot":
const ScatterplotSettingsComponent = settingsComponent(visualization.name);
const settings = visualizationSettings as ImmutableRecord<ScatterplotSettings>;
return <ScatterplotSettingsComponent onChange={this.changeSettings} settings={settings} />;
return <ScatterplotSettingsComponent onChange={this.changeSettings as Unary<ImmutableRecord<ScatterplotSettings>, void>}
settings={visualizationSettings as ImmutableRecord<ScatterplotSettings>} />;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ declare module "@vx/tooltip" {
const TooltipWithBounds: React.ComponentType<TooltipWithBoundsProps>;
}

declare module 'react-syntax-highlighter/src/light' {
export { default } from 'react-syntax-highlighter/dist/esm/light'
declare module "react-syntax-highlighter/src/light" {
export { default } from "react-syntax-highlighter/dist/esm/light";
}

declare module 'react-syntax-highlighter/src/styles/hljs/github-gist' {
export { default } from 'react-syntax-highlighter/dist/esm/styles/hljs/github-gist';
declare module "react-syntax-highlighter/src/styles/hljs/github-gist" {
export { default } from "react-syntax-highlighter/dist/esm/styles/hljs/github-gist";
}
7 changes: 4 additions & 3 deletions src/common/models/essence/essence.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { SortDirection } from "../sort/sort";
import { booleanSplitCombine, numberSplitCombine, stringSplitCombine, timeSplitCombine } from "../split/split.fixtures";
import { EMPTY_SPLITS, Splits } from "../splits/splits";
import { TimeShift } from "../time-shift/time-shift";
import { VisualizationManifest } from "../visualization-manifest/visualization-manifest";
import { Essence, EssenceValue, VisStrategy } from "./essence";

const defaultEssence: EssenceValue = {
Expand Down Expand Up @@ -70,7 +71,7 @@ export class EssenceFixtures {
static lineChart(): EssenceValue {
return {
...defaultEssence,
visualization: LINE_CHART_MANIFEST
visualization: LINE_CHART_MANIFEST as unknown as VisualizationManifest
};
}

Expand Down Expand Up @@ -130,7 +131,7 @@ export class EssenceFixtures {
];
return new Essence({
dataCube: wikiClientDataCube,
visualization: TABLE_MANIFEST,
visualization: TABLE_MANIFEST as unknown as VisualizationManifest,
visualizationSettings: TABLE_MANIFEST.visualizationSettings.defaults,
timezone: Timezone.fromJS("Etc/UTC"),
timeShift: TimeShift.empty(),
Expand Down Expand Up @@ -158,7 +159,7 @@ export class EssenceFixtures {
];
return new Essence({
dataCube: wikiClientDataCube,
visualization: LINE_CHART_MANIFEST,
visualization: LINE_CHART_MANIFEST as unknown as VisualizationManifest,
visualizationSettings: LINE_CHART_MANIFEST.visualizationSettings.defaults,
timezone: Timezone.fromJS("Etc/UTC"),
timeShift: TimeShift.empty(),
Expand Down
6 changes: 3 additions & 3 deletions src/common/visualization-manifests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import { TOTALS_MANIFEST } from "./totals/totals";
export const MANIFESTS: VisualizationManifest[] = [
TOTALS_MANIFEST,
GRID_MANIFEST,
LINE_CHART_MANIFEST,
LINE_CHART_MANIFEST as unknown as VisualizationManifest,
BAR_CHART_MANIFEST,
HEAT_MAP_MANIFEST,
TABLE_MANIFEST,
SCATTERPLOT_MANIFEST
TABLE_MANIFEST as unknown as VisualizationManifest,
SCATTERPLOT_MANIFEST as unknown as VisualizationManifest
];

export function manifestByName(visualizationName: string): VisualizationManifest {
Expand Down
2 changes: 1 addition & 1 deletion src/common/visualization-manifests/line-chart/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export const settings: LineChartVisualizationSettings = {
print: (settings: ImmutableRecord<LineChartSettings>) => settings.toJS(),
read: (input: LineChartSettings) => createSettings({ groupSeries: !!input.groupSeries })
},
defaults: createSettings({})
defaults: createSettings({}) as ImmutableRecord<object>
};
2 changes: 1 addition & 1 deletion src/common/visualization-manifests/scatterplot/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ export const settings: ScatterplotVisualizationSettings = {
print: (settings: ImmutableRecord<ScatterplotSettings>) => settings.toJS(),
read: (input: ScatterplotSettings) => createSettings({ showSummary: Boolean(input.showSummary) })
},
defaults: createSettings({})
defaults: createSettings({}) as ImmutableRecord<object>
};
2 changes: 1 addition & 1 deletion src/common/visualization-manifests/table/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export const settings: TableConfig = {
print: (settings: ImmutableRecord<TableSettings>) => settings.toJS(),
read: (input: TableSettings) => createSettings({ collapseRows: !!input.collapseRows })
},
defaults: createSettings({})
defaults: createSettings({}) as ImmutableRecord<object>
};