fsprojects / FSharp.Formatting

F# tools for generating documentation (Markdown processor and F# code formatter)
https://fsprojects.github.io/FSharp.Formatting/
Other
462 stars 155 forks source link

Is it possible to expose the `ApiDocMember.Parameters` using a "real" record? #735

Open MangelMaxime opened 2 years ago

MangelMaxime commented 2 years ago

Currently, they are exposed using an anonymous record, this means that I can't easily pass it to a function to manipulate them.

image

My function is defined as:

        let rec extractParametersInformation
            (state : Common.ParamTypesInformation)
            (parameters : list<{| 
                    ParameterDocs: option<ApiDocHtml>
                    ParameterNameText: string
                    ParameterSymbol: Choice<FSharp.Compiler.Symbols.FSharpParameter,FSharp.Compiler.Symbols.FSharpField>
                    ParameterType: ApiDocHtml |}>) =

But because, anonymous record from different assembly aren't compatible, I can't use it. I tried to let type inference do the work but the type cannot be inferred in this situation.

This means, I need to pre-process the anonymous record before using it.

I think, it makes sense to not use an anonymous record here because this is a public API.

dsyme commented 2 years ago

Agreed!