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

Symbol property name causes invalid F# code generation #154

Closed
NatElkins opened this issue Nov 18, 2024 · 1 comment
Closed

Symbol property name causes invalid F# code generation #154

NatElkins opened this issue Nov 18, 2024 · 1 comment

Comments

@NatElkins
Copy link
Contributor

Issue created from Glutinum Tool

Glutinum version - 0.11.0-preview

TypeScript

	export class DataTransfer implements Iterable<[mimeType: string, item: DataTransferItem]> {
		/**
		 * Retrieves the data transfer item for a given mime type.
		 *
		 * @param mimeType The mime type to get the data transfer item for, such as `text/plain` or `image/png`.
		 * Mimes type look ups are case-insensitive.
		 *
		 * Special mime types:
		 * - `text/uri-list` — A string with `toString()`ed Uris separated by `\r\n`. To specify a cursor position in the file,
		 * set the Uri's fragment to `L3,5`, where 3 is the line number and 5 is the column number.
		 */
		get(mimeType: string): DataTransferItem | undefined;

		/**
		 * Sets a mime type to data transfer item mapping.
		 *
		 * @param mimeType The mime type to set the data for. Mimes types stored in lower case, with case-insensitive looks up.
		 * @param value The data transfer item for the given mime type.
		 */
		set(mimeType: string, value: DataTransferItem): void;

		/**
		 * Allows iteration through the data transfer items.
		 *
		 * @param callbackfn Callback for iteration through the data transfer items.
		 * @param thisArg The `this` context used when invoking the handler function.
		 */
		forEach(callbackfn: (item: DataTransferItem, mimeType: string, dataTransfer: DataTransfer) => void, thisArg?: any): void;

		/**
		 * Get a new iterator with the `[mime, item]` pairs for each element in this data transfer.
		 */
		[Symbol.iterator](): IterableIterator<[mimeType: string, item: DataTransferItem]>;
	}

FSharp

module rec Glutinum

open Fable.Core
open Fable.Core.JsInterop
open System

[<AbstractClass>]
[<Erase>]
type Exports =
    [<Import("DataTransfer", "REPLACE_ME_WITH_MODULE_NAME"); EmitConstructor>]
    static member DataTransfer () : DataTransfer = nativeOnly

[<AllowNullLiteral>]
[<Interface>]
type DataTransfer =
    inherit Iterable<string * DataTransferItem>
    abstract member get: mimeType: string -> DataTransferItem option
    abstract member set: mimeType: string * value: DataTransferItem -> unit
    abstract member forEach: callbackfn: DataTransfer.forEach.callbackfn * ?thisArg: obj -> unit
    abstract member [Symbol_iterator]: unit -> IterableIterator<string * DataTransferItem>

module DataTransfer =

    module forEach =

        type callbackfn =
            delegate of item: DataTransferItem * mimeType: string * dataTransfer: DataTransfer -> unit

Problem description

I'm trying to create bindings to @types/vscode. The abstract member [Symbol_iterator]: unit -> IterableIterator<string * DataTransferItem> is not valid F# code.

Also Iterable isn't implemented, but I think that's more likely to be a Fable thing.

@MangelMaxime
Copy link
Contributor

This is fixed in the preview version (available online)

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

2 participants