ts2fable merges documentation for member overloads resulting in too many parameters

Open
#421 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
fsharp, typescript
Domain
tooling

Research direction

Start by reproducing the reported output with the TypeScript overload snippet and trace how member overloads receive JSDoc and parameter metadata. The fix is complete when the generated F# documentation is attached appropriately to the overloads, includes only applicable parameters, and no longer produces warnings for this case.

Written by the indexing model from the issue text.

Description

given the following TS:

        /**
         * Register a signature help provider.
         *
         * Multiple providers can be registered for a language. In that case providers are sorted
         * by their {@link languages.match score} and called sequentially until a provider returns a
         * valid result.
         *
         * @param selector A selector that defines the documents this provider is applicable to.
         * @param provider A signature help provider.
         * @param triggerCharacters Trigger signature help when the user types one of the characters, like `,` or `(`.
         * @param metadata Information about the provider.
         * @return A {@link Disposable} that unregisters this provider when being disposed.
         */
        export function registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, ...triggerCharacters: string[]): Disposable;
        export function registerSignatureHelpProvider(selector: DocumentSelector, provider: SignatureHelpProvider, metadata: SignatureHelpProviderMetadata): Disposable;

ts2fable 0.8.0-build.616 generates the following F#:

            /// <summary>
            /// Register a signature help provider.
            /// 
            /// Multiple providers can be registered for a language. In that case providers are sorted
            /// by their <see cref="languages.match">score</see> and called sequentially until a provider returns a
            /// valid result.
            /// </summary>
            /// <param name="selector">A selector that defines the documents this provider is applicable to.</param>
            /// <param name="provider">A signature help provider.</param>
            /// <param name="triggerCharacters">Trigger signature help when the user types one of the characters, like <c>,</c> or <c>(</c>.</param>
            /// <param name="metadata">Information about the provider.</param>
            /// <returns>A <see cref="Disposable" /> that unregisters this provider when being disposed.</returns>
            abstract registerSignatureHelpProvider: selector: DocumentSelector * provider: SignatureHelpProvider * [<ParamArray>] triggerCharacters: string[] -> Disposable
            abstract registerSignatureHelpProvider: selector: DocumentSelector * provider: SignatureHelpProvider * metadata: SignatureHelpProviderMetadata -> Disposable

the problem here is that the TS intended for the jsdoc to contain the superset of parameters for both overloads, but that superset has only been attached to the top overload in F#. it also has all parameters, which causes warnings.

Dominant language
F#
Stars
232
Forks
35
Avg merge
11h 44m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fable-compiler/ts2fable

All issues in fable-compiler/ts2fable

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.