ttag-org/ttag

msgid no longer supports string types

jorrit opened this issue · 3 comments

jorrit commented

I use msgid inside ngettext to get a plural string. I also add some other, nonnumeric arguments:

        {ngettext(
          msgid`Based on ${numberOfRatings} review of customers that traveled with ${supplierName}.`,
          `Based on ${numberOfRatings} reviews of customers that traveled with ${supplierName}.`,
          numberOfRatings
        )}

This used to work fine.
However, in 1.8.0 typescript was introduced, and the type of msgid is:

export declare function msgid(strings: TemplateStringsArray, ...exprs: number[]): StringWithRawData;

The resulting error is:

TS2345: Argument of type string is not assignable to parameter of type number

I think the type of ...exprs should be any[], just like with the t function.

Related to #267.

jorrit commented

Thanks!

You can try fix in ttag@1.8.5. Thanks for the report and big thank to @stoyanovk for the fix 💪