forked from lingui/js-lingui
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
50 lines (44 loc) · 1.37 KB
/
index.d.ts
File metadata and controls
50 lines (44 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type { ReactElement, ComponentType, ReactNode } from "react"
import type { MessageDescriptor } from "@lingui/core"
import type { TransRenderProps } from "@lingui/react"
export function t(
literals: TemplateStringsArray | MessageDescriptor,
...placeholders: any[]
): string
export type ChoiceOptions<T = string> = {
[digit: number]: T
offset?: number
zero?: T
one?: T
few?: T
many?: T
other?: T
}
export function plural(arg: number | string, options: ChoiceOptions): string
export function selectOrdinal(
arg: number | string,
options: ChoiceOptions
): string
export function select(arg: string, choices: Record<string, string>): string
export function defineMessages<M extends Record<string, MessageDescriptor>>(
messages: M
): M
export function defineMessage(descriptor: MessageDescriptor): MessageDescriptor
export type TransProps = {
id?: string
comment?: string
component?: ReactElement<any, any> | null
render?: (props: TransRenderProps) => ReactElement<any, any> | null
}
export type ChoiceProps = {
value?: string | number
} & TransProps &
ChoiceOptions<ReactNode>
export type SelectProps = {
value?: string
other?: ReactNode
} & TransProps
export const Trans: ComponentType<TransProps>
export const Plural: ComponentType<ChoiceProps>
export const Select: ComponentType<SelectProps>
export const SelectOrdinal: ComponentType<ChoiceProps>