From 73c7da8e9b59075adb6bd84cf92259c5822cf83c Mon Sep 17 00:00:00 2001 From: Wanasit Tanakitrungruang Date: Sun, 5 Jun 2022 12:51:49 +0900 Subject: [PATCH] FIX: typescript error and warning --- src/results.ts | 6 +++--- src/utils/timeunits.ts | 4 ++-- tsconfig.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/results.ts b/src/results.ts index 1c06eedf..b275e0c2 100644 --- a/src/results.ts +++ b/src/results.ts @@ -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); @@ -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); diff --git a/src/utils/timeunits.ts b/src/utils/timeunits.ts index 3e291fe4..d6bf909c 100644 --- a/src/utils/timeunits.ts +++ b/src/utils/timeunits.ts @@ -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) { diff --git a/tsconfig.json b/tsconfig.json index 4e9cfa79..25b90c9c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "sourceMap": false, + "sourceMap": true, "inlineSources": false, "inlineSourceMap": false, "noEmit": false,