Skip to content

Commit

Permalink
fix(chart,options): fix types after last commit (#797)
Browse files Browse the repository at this point in the history
* chart: Remove no-longer necessary @ts-expect-error

* options: Return a new tranformed object with correct types
  rather than mutating in place.

cc: @eddie-atkinson
  • Loading branch information
gadicc committed Sep 18, 2024
1 parent 696baf6 commit 27150e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/modules/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ export default async function chart(
if (timestamp)
for (let i = 0; i < timestamp.length; i++) {
result2.quotes[i] = {
// @ts-expect-error (eatkinson): clean this up with type in followup
date: new Date(timestamp[i] * 1000),
high: result.indicators.quote[0].high[i],
volume: result.indicators.quote[0].volume[i],
Expand Down
11 changes: 7 additions & 4 deletions src/modules/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,14 @@ export default function options(
transformWith(queryOptions: OptionsOptions) {
// This is honestly the easiest way to coerce the date properly
const parsed = Value.Decode(OptionsOptionsSchema, queryOptions);
const transformed = parsed.date
? {
...parsed,
date: Math.floor(parsed.date.getTime() / 1000),
}
: parsed;

if (parsed.date) {
queryOptions.date = Math.floor(parsed.date.getTime() / 1000);
}
return queryOptions;
return transformed;
},
},

Expand Down

0 comments on commit 27150e6

Please sign in to comment.