Skip to content

Restore ToQuantity(int) and ToQuantity(int, string) overloads #1652

@jonsagara

Description

@jonsagara

Hi,

I just updated to Humanizer 3.0.1 in my mixed C#/F# solution, and I got all kinds of build errors around ToQuantity where I pass in an Int32 as the count.

Example F#: let warningText = "warning".ToQuantity(errors.Count, "N0")

Example C#: var numbersText = "item".ToQuantity(numbers.Length);

In C#, this compiles fine.

In F#, where the type system is more strict, I now have over 130 of the following errors:

A unique overload for method 'ToQuantity' could not be determined based on type information prior to this program point. A type annotation may be needed.��Known types of arguments: int * string��Candidates:� - (extension) String.ToQuantity(quantity: float, ?format: string | null, ?formatProvider: IFormatProvider | null) : string� - (extension) String.ToQuantity(quantity: int64, format: string | null, ?formatProvider: IFormatProvider | null) : string

Looking through the release notes, I found this change: remove redundant ToQuantityExtensions overloads

Can you please revert that change to provide better support to F# calling libraries?

Thank you,

Jon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions