Zaid-Ajaj / Fable.Remoting

Type-safe communication layer (RPC-style) for F# featuring Fable and .NET Apps
https://zaid-ajaj.github.io/Fable.Remoting/
MIT License
272 stars 54 forks source link

Extension method `SaveFileAs` not found #271

Closed d3xter closed 2 years ago

d3xter commented 2 years ago

I've tried to implement a Download using Fable.Remoting but during compilation npm fails with the following error:

error FSHARP: The type '[]' does not define the field, constructor or member 'SaveFileAs'. (code 39)

The corresponding code looks like:

[...]
| Download (data: byte array), _ ->
        data.SaveFileAs("test.csv", "text/csv")

        model, Cmd.none
[...]

Intellij Rider resolves the extension method fine.

The paket.references of the Fable project contains Fable.Remoting.Client and is using Version 7.16.0

Am I missing something?

Zaid-Ajaj commented 2 years ago

@d3xter Do you have namespace Fable.Remoting.Client open in your file?

d3xter commented 2 years ago

@Zaid-Ajaj

Yes, I've moved the code into its own file:

module Client.Test

open Fable.Remoting.Client

let downloadFile (data: byte[]) =
    data.SaveFileAs("test.csv")

and called this method from update, still same Error as before.

Currently I'm using/running the following versions:

FSharp.Core: 5.0.2 Fable.Remoting.Client: 7.16.0 .NET Core SDK: 3.1.118 npm: 7.23.0

d3xter commented 2 years ago

As a side note: Right now when running dotnet build I get the following error:

FSC : error FS0193: The module/namespace 'Encode' from compilation unit 'Thoth.Json' did not contain the val 'ValLinkagePartialKey(generateEncoder)'

which doesn't happen when running npm run build/start,

Maybe there is something broken inside my Solution?

d3xter commented 2 years ago

I did upgrade to net5.0 and the newest SAFE template 3.1.1 and the error is gone