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

Rollback LocalePresetType to string #968

Merged
merged 2 commits into from
Jul 29, 2020
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
10 changes: 5 additions & 5 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ declare function dayjs (date?: dayjs.ConfigType): dayjs.Dayjs

declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, strict?: boolean): dayjs.Dayjs

declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: LocalePresetType, strict?: boolean): dayjs.Dayjs
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean): dayjs.Dayjs

declare namespace dayjs {
export type ConfigType = string | number | Date | Dayjs

export type OptionType = { locale?: LocalePresetType, format?: string, utc?: boolean } | string | string[]
export type OptionType = { locale?: string, format?: string, utc?: boolean } | string | string[]

type UnitTypeShort = 'd' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'
export type UnitType = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date' | UnitTypeShort;
Expand Down Expand Up @@ -96,16 +96,16 @@ declare namespace dayjs {

isAfter(date: ConfigType, unit?: OpUnitType): boolean

locale(): LocalePresetType
locale(): string

locale(preset: LocalePresetType | ILocale, object?: Partial<ILocale>): Dayjs
locale(preset: string | ILocale, object?: Partial<ILocale>): Dayjs
}

export type PluginFunc<T = unknown> = (option: T, c: typeof Dayjs, d: typeof dayjs) => void

export function extend<T = unknown>(plugin: PluginFunc<T>, option?: T): Dayjs

export function locale(preset?: LocalePresetType | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string
export function locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string

export function isDayjs(d: any): d is Dayjs

Expand Down
137 changes: 0 additions & 137 deletions types/locale/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,140 +31,3 @@ declare interface ILocale {
yy: string
}>
}

declare type LocalePresetType =
| 'af'
| 'ar-dz'
| 'ar-kw'
| 'ar-ly'
| 'ar-ma'
| 'ar-sa'
| 'ar-tn'
| 'ar'
| 'az'
| 'be'
| 'bg'
| 'bi'
| 'bm'
| 'bn'
| 'bo'
| 'br'
| 'bs'
| 'ca'
| 'cs'
| 'cv'
| 'cy'
| 'da'
| 'de-at'
| 'de-ch'
| 'de'
| 'dv'
| 'el'
| 'en-SG'
| 'en-au'
| 'en-ca'
| 'en-gb'
| 'en-ie'
| 'en-il'
| 'en-in'
| 'en-nz'
| 'en-tt'
| 'en'
| 'eo'
| 'es-do'
| 'es-us'
| 'es'
| 'et'
| 'eu'
| 'fa'
| 'fi'
| 'fo'
| 'fr-ca'
| 'fr-ch'
| 'fr'
| 'fy'
| 'ga'
| 'gd'
| 'gl'
| 'gom-latn'
| 'gu'
| 'he'
| 'hi'
| 'hr'
| 'hu'
| 'hy-am'
| 'id'
| 'is'
| 'it-ch'
| 'it'
| 'ja'
| 'jv'
| 'ka'
| 'kk'
| 'km'
| 'kn'
| 'ko'
| 'ku'
| 'ky'
| 'lb'
| 'lo'
| 'lt'
| 'lv'
| 'me'
| 'mi'
| 'mk'
| 'ml'
| 'mn'
| 'mr'
| 'ms-my'
| 'ms'
| 'mt'
| 'my'
| 'nb'
| 'ne'
| 'nl-be'
| 'nl'
| 'nn'
| 'oc-lnc'
| 'pa-in'
| 'pl'
| 'pt-br'
| 'pt'
| 'ro'
| 'ru'
| 'rw'
| 'sd'
| 'se'
| 'si'
| 'sk'
| 'sl'
| 'sq'
| 'sr-cyrl'
| 'sr'
| 'ss'
| 'sv'
| 'sw'
| 'ta'
| 'te'
| 'tet'
| 'tg'
| 'th'
| 'tk'
| 'tl-ph'
| 'tlh'
| 'tr'
| 'tzl'
| 'tzm-latn'
| 'tzm'
| 'ug-cn'
| 'uk'
| 'ur'
| 'uz-latn'
| 'uz'
| 'vi'
| 'x-pseudo'
| 'yo'
| 'zh-cn'
| 'zh-hk'
| 'zh-tw'
| 'zh'