Skip to content

Commit

Permalink
fix: export type of duration plugin (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
CatsMiaow authored Oct 2, 2020
1 parent 2e1e426 commit 2c92e71
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions types/plugin/duration.d.ts
Original file line number Diff line number Diff line change
@@ -1,58 +1,61 @@
import { PluginFunc } from 'dayjs'

declare const plugin: PluginFunc
export default plugin
export as namespace plugin;
export = plugin

type DurationInputType = string | number | object
type DurationAddType = number | object | Duration
declare namespace plugin {
type DurationInputType = string | number | object
type DurationAddType = number | object | Duration

export declare class Duration {
constructor (input: DurationInputType, unit?: string, locale?: string)
interface Duration {
new (input: DurationInputType, unit?: string, locale?: string): Duration

clone(): Duration

humanize(withSuffix?: boolean): string
clone(): Duration

milliseconds(): number
asMilliseconds(): number
humanize(withSuffix?: boolean): string

seconds(): number
asSeconds(): number
milliseconds(): number
asMilliseconds(): number

minutes(): number
asMinutes(): number
seconds(): number
asSeconds(): number

hours(): number
asHours(): number
minutes(): number
asMinutes(): number

days(): number
asDays(): number
hours(): number
asHours(): number

weeks(): number
asWeeks(): number
days(): number
asDays(): number

months(): number
asMonths(): number
weeks(): number
asWeeks(): number

years(): number
asYears(): number
months(): number
asMonths(): number

as(unit: string): number
years(): number
asYears(): number

get(unit: string): number
as(unit: string): number

add(input: DurationAddType, unit? : string): Duration

subtract(input: DurationAddType, unit? : string): Duration
get(unit: string): number

toJSON(): string
add(input: DurationAddType, unit? : string): Duration

toISOString(): string
subtract(input: DurationAddType, unit? : string): Duration

locale(locale: string): Duration
toJSON(): string

toISOString(): string

locale(locale: string): Duration
}
}

declare module 'dayjs' {
export function duration(input?: DurationInputType , unit?: string): Duration
export function isDuration(d: any): d is Duration
export function duration(input?: plugin.DurationInputType , unit?: string): plugin.Duration
export function isDuration(d: any): d is plugin.Duration
}

0 comments on commit 2c92e71

Please sign in to comment.