-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: export type of duration plugin (#1094)
- Loading branch information
Showing
1 changed file
with
37 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |