Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<t extends string> being emitted as 'T instead of string #437

Open
baronfel opened this issue Mar 31, 2022 · 0 comments
Open

<t extends string> being emitted as 'T instead of string #437

baronfel opened this issue Mar 31, 2022 · 0 comments

Comments

@baronfel
Copy link

Here's a chunk out of a recent vscode typescript definition that describes a series of overloads to the showInformationMessage method. The API can take either strings or MessageItem-derived types, but the way it surfaces the T for strings doesn't translate well currently in ts2fable. T extends string Is used to forward along anonymous unions of specific string values, I believe, but for F# purposes we probably just care about raw string here. Emitting T extends string as 'T causes errors for these overloads, since there's already a set of overloads defined that clobber here.

Input

        /**
         * Show an information message to users. Optionally provide an array of items which will be presented as
         * clickable buttons.
         *
         * @param message The message to show.
         * @param items A set of items that will be rendered as actions in the message.
         * @return A thenable that resolves to the selected item or `undefined` when being dismissed.
         */
        export function showInformationMessage<T extends string>(message: string, ...items: T[]): Thenable<T | undefined>;

        /**
         * Show an information message to users. Optionally provide an array of items which will be presented as
         * clickable buttons.
         *
         * @param message The message to show.
         * @param options Configures the behaviour of the message.
         * @param items A set of items that will be rendered as actions in the message.
         * @return A thenable that resolves to the selected item or `undefined` when being dismissed.
         */
        export function showInformationMessage<T extends string>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;

        /**
         * Show an information message.
         *
         * @see {@link window.showInformationMessage showInformationMessage}
         *
         * @param message The message to show.
         * @param items A set of items that will be rendered as actions in the message.
         * @return A thenable that resolves to the selected item or `undefined` when being dismissed.
         */
        export function showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T | undefined>;

        /**
         * Show an information message.
         *
         * @see {@link window.showInformationMessage showInformationMessage}
         *
         * @param message The message to show.
         * @param options Configures the behaviour of the message.
         * @param items A set of items that will be rendered as actions in the message.
         * @return A thenable that resolves to the selected item or `undefined` when being dismissed.
         */
        export function showInformationMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T | undefined>;

output

 /// <summary>
            /// Show an information message to users. Optionally provide an array of items which will be presented as
            /// clickable buttons.
            /// </summary>
            /// <param name="message">The message to show.</param>
            /// <param name="items">A set of items that will be rendered as actions in the message.</param>
            /// <returns>A thenable that resolves to the selected item or <c>undefined</c> when being dismissed.</returns>
            abstract showInformationMessage: message: string * [<ParamArray>] items: 'T[] -> Thenable<'T option>
            /// <summary>
            /// Show an information message to users. Optionally provide an array of items which will be presented as
            /// clickable buttons.
            /// </summary>
            /// <param name="message">The message to show.</param>
            /// <param name="options">Configures the behaviour of the message.</param>
            /// <param name="items">A set of items that will be rendered as actions in the message.</param>
            /// <returns>A thenable that resolves to the selected item or <c>undefined</c> when being dismissed.</returns>
            abstract showInformationMessage: message: string * options: MessageOptions * [<ParamArray>] items: 'T[] -> Thenable<'t option>
            /// <summary>Show an information message.</summary>
            /// <seealso cref="window.showInformationMessage">showInformationMessage</seealso>
            /// <param name="message">The message to show.</param>
            /// <param name="items">A set of items that will be rendered as actions in the message.</param>
            /// <returns>A thenable that resolves to the selected item or <c>undefined</c> when being dismissed.</returns>
            abstract showInformationMessage: message: string * [<ParamArray>] items: 'T[] -> Thenable<'T option> when 'T :> MessageItem
            /// <summary>Show an information message.</summary>
            /// <seealso cref="window.showInformationMessage">showInformationMessage</seealso>
            /// <param name="message">The message to show.</param>
            /// <param name="options">Configures the behaviour of the message.</param>
            /// <param name="items">A set of items that will be rendered as actions in the message.</param>
            /// <returns>A thenable that resolves to the selected item or <c>undefined</c> when being dismissed.</returns>
            abstract showInformationMessage: message: string * options: MessageOptions * [<ParamArray>] items: 'T[] -> Thenable<'T option> when 'T :> MessageItem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant