Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made the exports into explicitly types #408

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions types/constraints.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,22 @@ export type Format =
| 'nice-full'
| string


export interface I18nOptions {
/** Alternatives to Monday, Tuesday..*/
days?: {
short: string[],
long: string[],
short: string[]
long: string[]
}
/** Alternatives to Jan, Feb..*/
months?: {
short: string[],
long: string[],
short: string[]
long: string[]
}
/** Alternatives to am, pm*/
ampm?: {
am: string,
pm: string,
am: string
pm: string
}
/** Default dayname formatting */
useTitleCase?: boolean
}
}
10 changes: 6 additions & 4 deletions types/constructors.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Spacetime, ParsableDate, TimezoneSet } from './types'
import type { Spacetime, ParsableDate, TimezoneSet } from './types'

export interface SpacetimeConstructorOptions {
/** javascript dates use millisecond-epochs, instead of second-epochs, like some other languages. This is a common bug, and by default spacetime warns if you set an epoch within January 1970. to disable set to true */
Expand Down Expand Up @@ -54,7 +54,11 @@ export interface SpacetimeConstructor {
* @param timezone Optional timezone. If omitted uses the browser timezone.
* @param options Options for silencing warnings.
*/
(parsableDate?: ParsableDate | null, timezone?: string, options?: SpacetimeConstructorOptions): Spacetime
(
parsableDate?: ParsableDate | null,
timezone?: string,
options?: SpacetimeConstructorOptions
): Spacetime
}

export interface SpacetimeStatic extends SpacetimeConstructor {
Expand Down Expand Up @@ -84,6 +88,4 @@ export interface SpacetimeStatic extends SpacetimeConstructor {

/** set as furthest-possible future date */
max: (timezone?: string, options?: SpacetimeConstructorOptions) => Spacetime

}

8 changes: 4 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SpacetimeStatic } from './constructors'
import type { SpacetimeStatic } from './constructors'

declare const spacetime: SpacetimeStatic

// We need to use a single default export here so everything lines up with the actual imported object from JS
export default spacetime

export * from './constructors'
export * from './constraints'
export * from './types'
export { SpacetimeConstructor, SpacetimeConstructorOptions, SpacetimeStatic } from './constructors'
export { Format, I18nOptions, TimeUnit } from './constraints'
export { Spacetime, Diff, ParsableDate, Progress, Since, TimezoneMeta, TimezoneSet } from './types'
2 changes: 1 addition & 1 deletion types/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TimeUnit, Format, I18nOptions } from './constraints'
import type { TimeUnit, Format, I18nOptions } from './constraints'

/** a date/timezone object */
export interface Spacetime {
Expand Down
Loading