Skip to content

Commit

Permalink
fix: remove import type for backwards compatibility
Browse files Browse the repository at this point in the history
* remove import type for older typescript versions
* change importsNotUsedAsValues from 'error' to 'preserve' to ignore errors resulting from removing all import type
Airfooox committed Mar 31, 2021
1 parent 8e78a08 commit 3e4d8ab
Showing 12 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/fieldCheckers/dayOfMonthChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CronData } from '../index'
import { CronData } from '../index'
import { err, Result } from '../result'
import checkField from '../helper'
import type { Options } from '../types'
import { Options } from '../types'

const checkDaysOfMonth = (
cronData: CronData,
4 changes: 2 additions & 2 deletions src/fieldCheckers/dayOfWeekChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CronData } from '../index'
import { CronData } from '../index'
import { err, Result } from '../result'
import checkField from '../helper'
import type { Options } from '../types'
import { Options } from '../types'

const checkDaysOfWeek = (
cronData: CronData,
4 changes: 2 additions & 2 deletions src/fieldCheckers/hourChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CronData } from '../index'
import { CronData } from '../index'
import { err, Result } from '../result'
import checkField from '../helper'
import type { Options } from '../types'
import { Options } from '../types'

const checkHours = (
cronData: CronData,
4 changes: 2 additions & 2 deletions src/fieldCheckers/minuteChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CronData } from '../index'
import { CronData } from '../index'
import { err, Result } from '../result'
import checkField from '../helper'
import type { Options } from '../types'
import { Options } from '../types'

const checkMinutes = (
cronData: CronData,
4 changes: 2 additions & 2 deletions src/fieldCheckers/monthChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CronData } from '../index'
import { CronData } from '../index'
import { err, Result } from '../result'
import checkField from '../helper'
import type { Options } from '../types'
import { Options } from '../types'

const checkMonths = (
cronData: CronData,
4 changes: 2 additions & 2 deletions src/fieldCheckers/secondChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CronData } from '../index'
import { CronData } from '../index'
import { err, Result } from '../result'
import checkField from '../helper'
import type { Options } from '../types'
import { Options } from '../types'

const checkSeconds = (
cronData: CronData,
4 changes: 2 additions & 2 deletions src/fieldCheckers/yearChecker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CronData } from '../index'
import { CronData } from '../index'
import { err, Result } from '../result'
import checkField from '../helper'
import type { Options } from '../types'
import { Options } from '../types'

const checkYears = (
cronData: CronData,
4 changes: 2 additions & 2 deletions src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CronFieldType } from './index'
import { CronFieldType } from './index'
import { Err, err, Result, Valid, valid } from './result'
import type { Options } from './types'
import { Options } from './types'

// Instead of translating the alias to a number, we just validate that it's an accepted alias.
// This is to avoid managing the limits with the translation to numbers.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import {
registerOptionPreset,
validateOptions,
} from './option'
import type { InputOptions, Options } from './types'
import { InputOptions, Options } from './types'

export interface CronData {
seconds?: string
2 changes: 1 addition & 1 deletion src/matrix.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cron from './index'
import type { InputOptions } from './types'
import { InputOptions } from './types'

type TestCase = {
value: string
4 changes: 2 additions & 2 deletions src/option.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as yup from 'yup'
import type { ValidationError } from 'yup'
import { ValidationError } from 'yup'
import { err, valid, Result } from './result'
import presets from './presets'
import type { Options, OptionPreset, InputOptions } from './types'
import { Options, OptionPreset, InputOptions } from './types'

const optionPresets: { [presetId: string]: OptionPreset } = {
// http://crontab.org/
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"rootDir": "src",
"outDir": "lib",
"lib": ["ESNext"],
"target": "es2017", // ES2017 is 100% supported in node.js 8.10.0.
"target": "ES2017", // ES2017 is 100% supported in node.js 8.10.0.
"module": "commonjs", // Node.js does not yet support es-modules.
"moduleResolution": "node",

@@ -13,7 +13,7 @@
"esModuleInterop": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"importsNotUsedAsValues": "error"
"importsNotUsedAsValues": "preserve"
},
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts"]

0 comments on commit 3e4d8ab

Please sign in to comment.