diff --git a/d3-format/d3-format-tests.ts b/d3-format/d3-format-tests.ts index 3fd5742997..57a98e26c6 100644 --- a/d3-format/d3-format-tests.ts +++ b/d3-format/d3-format-tests.ts @@ -63,11 +63,6 @@ num = d3Format.precisionRound(0.0005, 3000); // Test Locale Definition // ---------------------------------------------------------------------- -let decimal: '.' | ',' = localeDef.decimal; -let thousands: '.' | ',' | '\u00a0' | "'" = localeDef.thousands; -let grouping: Array = localeDef.grouping; -let currency: [string, string] = localeDef.currency; - localeDef = { decimal: ',', thousands: '.', @@ -75,6 +70,20 @@ localeDef = { currency: ['EUR', ''] }; +localeDef = { + decimal: "\u066b", + thousands: "\u066c", + grouping: [3], + currency: ["", ""], + numerals : ["\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669"] +} + +let decimal: string = localeDef.decimal; +let thousands: string = localeDef.thousands; +let grouping: Array = localeDef.grouping; +let currency: [string, string] = localeDef.currency; +let numerals: string[] | undefined = localeDef.numerals; + localeObj = d3Format.formatLocale(localeDef); localeObj = d3Format.formatDefaultLocale(localeDef); diff --git a/d3-format/index.d.ts b/d3-format/index.d.ts index 92197f6ab8..be6c2b9a99 100644 --- a/d3-format/index.d.ts +++ b/d3-format/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-format module v1.0.2 +// Type definitions for D3JS d3-format module 1.1 // Project: https://github.com/d3/d3-format/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.1.0 + /** * Specification of locale to use when creating a new FormatLocaleObject */ @@ -10,12 +12,12 @@ export interface FormatLocaleDefinition { /** * The decimal point (e.g., ".") */ - decimal: '.' | ','; + decimal: string; /** * The group separator (e.g., ","). Note that the thousands property is a misnomer, as\ * the grouping definition allows groups other than thousands. */ - thousands: '.' | ',' | '\u00a0' | "'"; + thousands: string; /** * The array of group sizes (e.g., [3]), cycled as needed. */ @@ -24,6 +26,10 @@ export interface FormatLocaleDefinition { * The currency prefix and suffix (e.g., ["$", ""]) */ currency: [string, string]; + /** + * An array of ten strings to replace the numerals 0-9. + */ + numerals?: string[]; } /**