chore: 🤖 oops, fix actual build-time types being git ignored

This commit is contained in:
Christian Kaisermann 2020-01-23 10:32:56 -03:00
parent 73c80e9bea
commit bb6dd01558
4 changed files with 66 additions and 3 deletions

2
.gitignore vendored
View File

@ -2,4 +2,4 @@ node_modules
*.log
dist/
coverage/
types/
/types/

View File

@ -1,6 +1,6 @@
import { writable, derived } from 'svelte/store'
import { LocaleDictionary, DeepDictionary, Dictionary } from '../types/index'
import { LocaleDictionary, DeepDictionary, Dictionary } from '../types'
import { flatObj } from '../includes/utils'
import { getFallbackOf } from './locale'

View File

@ -0,0 +1,63 @@
import { Formats } from 'intl-messageformat'
export interface DeepDictionary {
[key: string]: DeepDictionary | string | string[]
}
export type LocaleDictionary = Record<string, string>
export type Dictionary = Record<string, LocaleDictionary>
export interface MessageObject {
id?: string
locale?: string
format?: string
default?: string
values?: Record<string, string | number | Date>
}
export type MessageFormatter = (
id: string | MessageObject,
options?: MessageObject
) => string
export type TimeFormatter = (
d: Date | number,
options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>
) => string
export type DateFormatter = (
d: Date | number,
options?: IntlFormatterOptions<Intl.DateTimeFormatOptions>
) => string
export type NumberFormatter = (
d: number,
options?: IntlFormatterOptions<Intl.NumberFormatOptions>
) => string
type IntlFormatterOptions<T> = T & {
format?: string
locale?: string
}
export interface MemoizedIntlFormatter<T, U> {
(options?: IntlFormatterOptions<U>): T
}
export interface MessagesLoader {
(): Promise<any>
}
export interface GetClientLocaleOptions {
navigator?: boolean
hash?: string
search?: string
pathname?: RegExp
hostname?: RegExp
}
export interface ConfigureOptions {
fallbackLocale: string
initialLocale?: string | GetClientLocaleOptions
formats?: Partial<Formats>
loadingDelay?: number
}

View File

@ -1,4 +1,4 @@
import { Formatter } from '../../../src/runtime/types/index'
import { Formatter } from '../../../src/runtime/types'
import { $format } from '../../../src/runtime/stores/format'
import { init } from '../../../src/runtime/configs'
import { addMessages } from '../../../src/runtime/stores/dictionary'