Skip to content

Commit 247d086

Browse files
Fix compiler “Type 'string' is not assignable to type 'PluralRuleName'”
I18n.pluralRulesMap keys are variable so “string” wasn’t compatible when the compiler thought we were using fixed string literals Might be worth another look at `Object.keys()` in future with: * microsoft/TypeScript#45464
1 parent b694c4b commit 247d086

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/govuk/i18n.mjs

+2-8
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ I18n.prototype.selectPluralFormUsingFallbackRules = function (count) {
211211
* regardless of region. There are exceptions, however, (e.g. Portuguese) so
212212
* this searches by both the full and shortened locale codes, just to be sure.
213213
*
214-
* @returns {PluralRuleName | undefined} The name of the pluralisation rule to use (a key for one
214+
* @returns {string | undefined} The name of the pluralisation rule to use (a key for one
215215
* of the functions in this.pluralRules)
216216
*/
217217
I18n.prototype.getPluralRulesForLocale = function () {
@@ -262,7 +262,7 @@ I18n.prototype.getPluralRulesForLocale = function () {
262262
* Spanish: European Portuguese (pt-PT), Italian (it), Spanish (es)
263263
* Welsh: Welsh (cy)
264264
*
265-
* @type {Object<PluralRuleName, string[]>}
265+
* @type {Object<string, string[]>}
266266
*/
267267
I18n.pluralRulesMap = {
268268
arabic: ['ar'],
@@ -350,12 +350,6 @@ I18n.pluralRules = {
350350
/* eslint-enable jsdoc/require-jsdoc */
351351
}
352352

353-
/**
354-
* Supported languages for plural rules
355-
*
356-
* @typedef {'arabic' | 'chinese' | 'french' | 'german' | 'irish' | 'russian' | 'scottish' | 'spanish' | 'welsh'} PluralRuleName
357-
*/
358-
359353
/**
360354
* Plural rule category mnemonic tags
361355
*

0 commit comments

Comments
 (0)