Skip to content

Commit

Permalink
FIX: typescript error and warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Wanasit Tanakitrungruang committed Jun 5, 2022
1 parent 96ff2c2 commit 73c7da8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/results.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, ParsedComponents, ParsedResult, ParsingReference } from "./index";

import quarterOfYear from "dayjs/plugin/quarterOfYear";
import dayjs, { OpUnitType, QUnitType } from "dayjs";
import dayjs, { QUnitType } from "dayjs";
import { assignSimilarDate, assignSimilarTime, implySimilarTime } from "./utils/dayjs";
import { toTimezoneOffset } from "./timezone";
dayjs.extend(quarterOfYear);
Expand Down Expand Up @@ -175,11 +175,11 @@ export class ParsingComponents implements ParsedComponents {

static createRelativeFromReference(
reference: ReferenceWithTimezone,
fragments: { [c in OpUnitType | QUnitType]?: number }
fragments: { [c in QUnitType]?: number }
): ParsingComponents {
let date = dayjs(reference.instant);
for (const key in fragments) {
date = date.add(fragments[key as OpUnitType], key as OpUnitType);
date = date.add(fragments[key as QUnitType], key as QUnitType);
}

const components = new ParsingComponents(reference);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/timeunits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export function addImpliedTimeUnits(components: ParsingComponents, timeUnits: Ti

let date = components.dayjs();
for (const key in timeUnits) {
// noinspection JSUnfilteredForInLoop
date = date.add(timeUnits[key], key as OpUnitType);
// noinspection JSUnfilteredForInLoop,TypeScriptValidateTypes
date = date.add(timeUnits[key], key as QUnitType);
}

if ("day" in timeUnits || "d" in timeUnits || "week" in timeUnits || "month" in timeUnits || "year" in timeUnits) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"sourceMap": false,
"sourceMap": true,
"inlineSources": false,
"inlineSourceMap": false,
"noEmit": false,
Expand Down

0 comments on commit 73c7da8

Please sign in to comment.