Skip to content

Commit d1a09fc

Browse files
danielkaradachkiggkrustev
authored andcommitted
fix: add descriptions to members in d.ts files (#14)
1 parent cc2f815 commit d1a09fc

File tree

4 files changed

+251
-28
lines changed

4 files changed

+251
-28
lines changed

src/cldr.d.ts

Lines changed: 79 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,95 @@
1+
/**
2+
* Settings for the dateFormatNames function.
3+
*/
14
export interface DateFormatNameOptions {
2-
type: string;
3-
nameType: string;
4-
lower?: string;
5+
/**
6+
* Specifies the type of names.
7+
*/
8+
type: 'dayPeriods' | 'days' | 'months' | 'quarters' | 'eras';
9+
10+
/**
11+
* Specifies the names form.
12+
*/
13+
nameType: 'abbreviated' | 'narrow' | 'short' | 'wide';
14+
15+
/**
16+
* Specifies if the returned names should be converted to lower case.
17+
*/
18+
lower?: boolean;
19+
20+
/**
21+
* Specifies whether the standalone names should be returned.
22+
*/
523
standAlone?: string;
624
}
725

26+
/**
27+
* Returns the names from the specified locale based on the options.
28+
*
29+
* @param locale The locale id which defines the locale from which the names should be retrieved.
30+
* @param options The options that determine the returned names.
31+
* @returns The date format names.
32+
*/
33+
export function dateFormatNames(locale: string, options: DateFormatNameOptions): any;
34+
35+
/**
36+
* Returns the first day index starting from Sunday based on the specified locale.
37+
*
38+
* @param locale The locale id.
39+
* @returns The first day index.
40+
*/
41+
export function firstDay(locale: string): number;
42+
43+
/**
44+
* Loads CLDR data.
45+
*
46+
* @param data The CLDR data to be loaded. Accepts multiple parameters.
47+
*/
48+
export function load(...data: any[]): void;
49+
50+
/**
51+
* Returns the number symbols from the specified locale.
52+
*
53+
* @param locale The locale id which defines the locale for which the number symbols should be returned.
54+
* @returns The number symbols.
55+
*/
56+
export function numberSymbols(locale: string): any;
57+
58+
/**
59+
* @hidden
60+
*/
861
export interface CurrencyDisplayOptions {
962
currency: string;
1063
currencyDisplay?: string;
1164
value?: number;
1265
}
1366

67+
/**
68+
* @hidden
69+
*/
1470
export function currencyDisplay(locale: string, options: CurrencyDisplayOptions): any;
71+
72+
/**
73+
* @hidden
74+
*/
1575
export function currencyDisplays(locale: string, currency: string): any;
76+
77+
/**
78+
* @hidden
79+
*/
1680
export function currencyFractionOptions(locale: string): any;
17-
export function dateFormatNames(locale: string, options: DateFormatNameOptions): any;
18-
export function dateFormatNames(locale: string): any;
19-
export function firstDay(locale: string): number;
20-
export function load(...data: any[]): void;
81+
82+
/**
83+
* @hidden
84+
*/
2185
export function localeCurrency(locale: string): any;
86+
87+
/**
88+
* @hidden
89+
*/
2290
export function localeInfo(locale: string): any;
23-
export function numberSymbols(locale: string): any;
91+
92+
/**
93+
* @hidden
94+
*/
2495
export function territoryCurrencyCode(territory: string): any;

src/dates.d.ts

Lines changed: 97 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,104 @@
1+
/**
2+
* Settings for the formatDate and parseDate functions.
3+
*/
14
export interface DateFormatOptions {
5+
/**
6+
* Defines the skeleton format used to get the pattern from the locale calendar [`availableFormats`](http://www.unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems).
7+
*/
28
skeleton?: string;
3-
date?: string;
4-
time?: string;
5-
datetime?: string;
6-
era?: string;
7-
year?: string;
8-
month?: string;
9-
day?: string;
10-
weekday?: string;
11-
hour?: string;
9+
10+
/**
11+
* Specifies which of the locale `dateFormats` should be used to format the value.
12+
*/
13+
date?: 'short' | 'medium' | 'long' | 'full';
14+
15+
/**
16+
* Specifies which of the locale `timeFormats` should be used to format the value.
17+
*/
18+
time?: 'short' | 'medium' | 'long' | 'full';
19+
20+
/**
21+
* Specifies which of the locale `dateTimeFormats` should be used to format the value.
22+
*/
23+
datetime?: 'short' | 'medium' | 'long' | 'full';
24+
25+
/**
26+
* Specifies how should the date era be formatted.
27+
*/
28+
era?: 'narrow' | 'short' | 'long';
29+
30+
/**
31+
* Specifies how the date year should be formatted.
32+
*/
33+
year?: 'numeric' | '2-digit';
34+
35+
/**
36+
* Specifies how the date month should be formatted.
37+
*/
38+
month?: 'numeric' | '2-digit' | 'narrow' | 'short' | 'long';
39+
40+
/**
41+
* Specifies how the day of the month should be formatted.
42+
*/
43+
day?: 'numeric' | '2-digit';
44+
45+
/**
46+
* Specifies how the day of the week should be formatted.
47+
*/
48+
weekday?: 'narrow' | 'short' | 'long';
49+
50+
/**
51+
* Specifies how the hours should be formatted.
52+
*/
53+
hour?: 'numeric' | '2-digit';
54+
55+
/**
56+
* Specifies if a 12-hour time set should be used for the formatting.
57+
*/
1258
hour12?: boolean;
13-
minute?: string;
14-
second?: string;
15-
timeZoneName?: string;
59+
60+
/**
61+
* Specifies how the minutes should be formatted.
62+
*/
63+
minute?: 'numeric' | '2-digit';
64+
65+
/**
66+
* Specifies how the seconds should be formatted.
67+
*/
68+
second?: 'numeric' | '2-digit';
69+
70+
/**
71+
* Specifies how the timezone should be formatted.
72+
*/
73+
timeZoneName?: 'short' | 'long';
1674
}
1775

18-
export function formatDate(value: Date, format: String|DateFormatOptions, locale?: string): string;
76+
/**
77+
* Converts a `Date` object to a string based on the specified format and locale.
78+
*
79+
* @param value Defines the date to be formatted.
80+
* @param format Defines a string representing a predefined or custom date format, or a configuration object.
81+
* @param locale The optional locale id. If not specified, the `"en"` locale id is used.
82+
* @returns The formatted date.
83+
*/
84+
export function formatDate(value: Date, format: string|DateFormatOptions, locale?: string): string;
1985

20-
export function parseDate(value: string, format?: String|DateFormatOptions|Array<String>|Array<DateFormatOptions>, locale?: string): Date;
86+
/**
87+
* Converts a string to a `Date` object based on the specified format and locale.
88+
*
89+
* @param value Defines the string to be parsed.
90+
* @param format Defines a string representing a predefined or custom date format, a configuration object, or an array of formats that should be used to parse the value.
91+
* @param locale The optional locale id. If not specified, the `"en"` locale id is used.
92+
* @returns The parsed date.
93+
*/
94+
export function parseDate(value: string, format?: string | DateFormatOptions | string[] | DateFormatOptions[], locale?: string): Date;
2195

22-
export function dateFormatString(value: Date, format: String|DateFormatOptions, locale?: string): string;
96+
/**
97+
* Returns the full format based on the Date object and the specified format. If no format is provided, the default short date format is used.
98+
*
99+
* @param value The date to format.
100+
* @param format The format string or options.
101+
* @param locale The optional locale id. If not specified, the `"en"` locale id is used.
102+
* @returns The full date format.
103+
*/
104+
export function dateFormatString(value: Date, format: string|DateFormatOptions, locale?: string): string;

src/format.d.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
1-
export function toString(value: any, format: string, locale?: string): string;
2-
export function format(format: string, values: Array<any>, locale?: string): string;
1+
/**
2+
* Formats dates and numbers based on the specified format and locale.
3+
*
4+
* @param value The value to be formatted.
5+
* @param format A string representing a predefined or custom date or number format, or a configuration object.
6+
* @param locale The optional locale id. If not specified, the `"en"` locale id is used.
7+
* @returns The formatted value.
8+
*/
9+
export function toString(value: string | Date | number, format: string | any, locale?: string): string;
10+
11+
/**
12+
* Replaces the format string placeholders with the provided values based on the index.
13+
*
14+
* @param format The format string.
15+
* @param values The values that should be replaced in the format string.
16+
* @param locale The optional locale id. If not specified, the `"en"` locale id is used.
17+
* @returns The format string with replaced formatted values.
18+
*/
19+
export function format(format: string, values: any[], locale?: string): string;

src/numbers.d.ts

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,65 @@
1+
/**
2+
* Settings for the formatNumber and parseNumber functions.
3+
*/
14
export interface NumberFormatOptions {
2-
style?: string;
5+
6+
/**
7+
* Specifies the format style.
8+
*/
9+
style?: 'decimal' | 'currency' | 'precent' | 'scientific';
10+
11+
/**
12+
* Defines the currency code of the currency used in the formatting. If not specified, the default currency for the locale is used.
13+
*/
314
currency?: string;
4-
currencyDisplay?: string;
15+
16+
/**
17+
* Specifies how to display the currency.
18+
*/
19+
currencyDisplay?: 'symbol' | 'code' | 'name';
20+
21+
/**
22+
* Specifies whether to use grouping separators.
23+
*/
524
useGrouping?: boolean;
25+
26+
/**
27+
* Defines the minimum number of integer digits to be used in the formatting.
28+
*/
629
minimumIntegerDigits?: number;
30+
31+
/**
32+
* Defines the minimum number of fraction digits to use.
33+
* The default value for the decimal and percent formatting is 0 (zero).
34+
* The default value of the currency formatting is the number of digits for the currency from the supplemental `currencyData` or 2 if no info is provided for the currency.
35+
*/
736
minimumFractionDigits?: number;
37+
38+
/**
39+
* Defines the maximum number of fraction digits to be used.
40+
* The default value of the decimal formatting is the greater one between `minimumFractionDigits` and 3.
41+
* The default value of the currency formatting is the greater one between `minimumFractionDigits` and the number of digits for the currency from the supplemental `currencyData` or 2 if no info is provided for the currency.
42+
* The default value of the percent formatting is the greater one between `minimumFractionDigits` and 0 (zero).
43+
*/
844
maximumFractionDigits?: number;
945
}
1046

11-
export function parseNumber(value: string, locale?: string, format?: String|NumberFormatOptions): number;
47+
/**
48+
* Converts a string to a `Number` based on the specified locale.
49+
*
50+
* @param value The string to be parsed.
51+
* @param locale The locale id defining the locale which information should be used to parse the string.
52+
* @param format The format used to parse the string. Usefull if parsing non-default currencies.
53+
* @returns The parsed number.
54+
*/
55+
export function parseNumber(value: string, locale?: string, format?: string|NumberFormatOptions): number;
56+
57+
/**
58+
* Converts a `Number` to a string based on the specified format and locale.
59+
*
60+
* @param value The number to be formatted.
61+
* @param format The format to be applied.
62+
* @param locale The locale id defining the locale which information should be used for the formatting.
63+
* @returns The formatted number.
64+
*/
1265
export function formatNumber(value: number, format: string|NumberFormatOptions, locale?: string): string;

0 commit comments

Comments
 (0)