From dea71aade9af8e645a756009eb412ebd3882ca9c Mon Sep 17 00:00:00 2001 From: Jacob Craig Date: Mon, 5 Feb 2024 21:29:10 -0700 Subject: [PATCH] Made the exports into explicitly types --- types/constraints.d.ts | 15 +++++++-------- types/constructors.d.ts | 10 ++++++---- types/index.d.ts | 8 ++++---- types/types.d.ts | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/types/constraints.d.ts b/types/constraints.d.ts index 7b4177fd..0c3fde63 100644 --- a/types/constraints.d.ts +++ b/types/constraints.d.ts @@ -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 -} \ No newline at end of file +} diff --git a/types/constructors.d.ts b/types/constructors.d.ts index 89595d2c..8b2cdf1b 100644 --- a/types/constructors.d.ts +++ b/types/constructors.d.ts @@ -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 */ @@ -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 { @@ -84,6 +88,4 @@ export interface SpacetimeStatic extends SpacetimeConstructor { /** set as furthest-possible future date */ max: (timezone?: string, options?: SpacetimeConstructorOptions) => Spacetime - } - diff --git a/types/index.d.ts b/types/index.d.ts index 1508ca65..9526619a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -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' diff --git a/types/types.d.ts b/types/types.d.ts index 7319db75..4be20a42 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -1,4 +1,4 @@ -import { TimeUnit, Format, I18nOptions } from './constraints' +import type { TimeUnit, Format, I18nOptions } from './constraints' /** a date/timezone object */ export interface Spacetime {