Skip to content

Commit

Permalink
fix: use "import type"
Browse files Browse the repository at this point in the history
this will slightly reduce the size of js code
  • Loading branch information
unional committed Apr 13, 2023
1 parent a3ec66f commit 63cbcf1
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ts/assert-order/InvalidOrder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AssertionError } from '../errors.js'
import { State } from './types.js'
import type { State } from './types.js'

export class InvalidOrder extends AssertionError {
constructor(public state: State, public method: string, public args: any[], options: AssertionError.Options) {
Expand Down
2 changes: 1 addition & 1 deletion ts/assert-order/StateMachine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as perf from 'perf_hooks'
import { State } from './types.js'
import type { State } from './types.js'

let timeTracker: { start(): void, taken(): number }
// istanbul ignore else
Expand Down
2 changes: 1 addition & 1 deletion ts/assertron/assertron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { pathEqual } from './pathEqual.js'
import { rejects } from './rejects.js'
import { repeat } from './repeat.js'
import { resolves } from './resolves.js'
import { satisfies, SatisfyExpectation } from './satisfies.js'
import { satisfies, type SatisfyExpectation } from './satisfies.js'
import { throws } from './throws.js'
import { truthy } from './truthy.js'

Expand Down
2 changes: 1 addition & 1 deletion ts/assertron/satisfies.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSatisfier } from 'satisfier'
import { If, IsExtend, NonComposableTypes } from 'type-plus'
import type { If, IsExtend, NonComposableTypes } from 'type-plus'
import { AssertionError } from '../errors.js'
import { notSatisfiedMessage } from '../utils/index.js'

Expand Down
2 changes: 1 addition & 1 deletion ts/assertron/throws.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import isPromise from 'is-promise'
import { AssertionError } from '../errors.js'
import { ErrorConstructor, ErrorValidator } from '../types.js'
import type { ErrorConstructor, ErrorValidator } from '../types.js'
import { isErrorConstructor, notRejectedMessage, notThrownMessage, unexpectedErrorMessage } from '../utils/index.js'

export function throws<E extends Error>(value: PromiseLike<any>, error?: ErrorValidator | ErrorConstructor<E>): Promise<E>
Expand Down
6 changes: 3 additions & 3 deletions ts/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IsoError, ModuleError } from 'iso-error'
import { RequiredPick } from 'type-plus'
import { ModuleError } from 'iso-error'
import type { RequiredPick } from 'type-plus'
import { failOnOccurrence } from './utils/index.js'

/**
Expand All @@ -12,7 +12,7 @@ export class AssertionError extends ModuleError {
}

export namespace AssertionError {
export type Options = RequiredPick<IsoError.Options, 'ssf'>
export type Options = RequiredPick<ModuleError.Options, 'ssf'>
}

export class FailOnOccurrence extends AssertionError {
Expand Down
2 changes: 1 addition & 1 deletion ts/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import t from 'assert'
import isPromise from 'is-promise'
import { escapeRegExp, isError } from 'lodash'
import { ErrorConstructor } from './types.js'
import type { ErrorConstructor } from './types.js'

export type AnyFunction = (...args: any[]) => any

Expand Down
2 changes: 1 addition & 1 deletion ts/utils/isErrorConstructor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorConstructor } from '../types.js'
import type { ErrorConstructor } from '../types.js'

export function isErrorConstructor(validator: any): validator is ErrorConstructor<any> {
return Object.prototype.isPrototypeOf.call(Error.prototype, validator.prototype)
Expand Down
2 changes: 1 addition & 1 deletion ts/utils/notSatisfiedMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Diff } from 'satisfier'
import type { Diff } from 'satisfier'
import { tersify } from 'tersify'

export function notSatisfiedMessage(entries: Diff[]) {
Expand Down
2 changes: 1 addition & 1 deletion ts/utils/unexpectedErrorMessage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { tersify } from 'tersify'
import { ErrorConstructor, ErrorValidator } from '../types.js'
import type { ErrorConstructor, ErrorValidator } from '../types.js'
import { isErrorConstructor } from './isErrorConstructor.js'

export function unexpectedErrorMessage(actual: any, expected: ErrorValidator | ErrorConstructor<any>) {
Expand Down

0 comments on commit 63cbcf1

Please sign in to comment.