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

Optional parameter in lambda type becomes not optional #406

Open
Booksbaum opened this issue Apr 11, 2021 · 0 comments
Open

Optional parameter in lambda type becomes not optional #406

Booksbaum opened this issue Apr 11, 2021 · 0 comments
Labels

Comments

@Booksbaum
Copy link
Contributor

export const v: (value?: string) => string;

==>

let [<Import(...)>] v: (string -> string) = jsNative

Parameter isn't optional any more, should be string option.

more examples
export interface I {
    f(value?: string): string;
    readonly v: (value?: string) => string;
    fl(f: (value?: string) => string): void
}

export namespace N {
    function f(value?: string): string;
    const v: (value?: string) => string;
    function fl(f: (value?: string) => string): void

}

export function f(value?: string): string;
export const v: (value?: string) => string;
function fl(f: (value?: string) => string): void

==>

let [<Import("N","module")>] n: N.IExports = jsNative
let [<Import("v","module")>] v: (string -> string) = jsNative

type [<AllowNullLiteral>] IExports =
    abstract f: ?value: string -> string
    abstract fl: f: (string -> string) -> unit

type [<AllowNullLiteral>] I =
    abstract f: ?value: string -> string
    abstract v: (string -> string)
    abstract fl: f: (string -> string) -> unit

module N =

    type [<AllowNullLiteral>] IExports =
        abstract f: ?value: string -> string
        abstract v: (string -> string)
        abstract fl: f: (string -> string) -> unit
@Booksbaum Booksbaum added the bug label Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant