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

Import attribute handling #1392

Closed
Jooseppi12 opened this issue Feb 15, 2024 · 1 comment
Closed

Import attribute handling #1392

Jooseppi12 opened this issue Feb 15, 2024 · 1 comment

Comments

@Jooseppi12
Copy link
Member

Consider the following code:

[<Import ("myFunction", "myModule")>]
let myFunction (str: string) = X<unit>

The above would describe a function in F# that would be translated to a call myFunction from the myModule import. At the moment the above code does not compile, as the X is failing, as this Import is not treated as an inline.

Known workaround at the moment is to apply an inline as well, like this:

[<Import ("myFunction", "myModule"); Inline "$import($str)">]
let myFunction (str: string) = X<unit>

Ideally we don't want to rely on the Inline to make this work, just applying the import attribute should work.

Jand42 added a commit that referenced this issue Feb 17, 2024
@Jand42
Copy link
Member

Jand42 commented Feb 17, 2024

The Import attribute alone has previously not marked the member on its own for client-side. Now it auto-implies Stub if there is no JavaScript or Inline or Direct present.

Fixed the behavior of Stub+Import. For a class, it's valid to mark the class itself with Import, then all the members will follow existing Stub logic, while the JS class constructor is set by the Import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants