This repo is to demonstrate and reproduce a bug introduced in Fable 4.1.3 and still present in 4.2.2.
When an interface is defined in one file (see Source.fs
) and the interface is used as a generic interface type constraint for a discriminated union in another file (see Program.fs
), the generated JavaScript file containing the DU attempts to import the interface even though no code is generated for the interface.
- Operation system: macOS 14.0
- .NET SDK: 7.0.401 and 8.0.100-rc.2.23502.2
- Fable compiler: 4.1.3 and 4.2.2
- Clone the repo
dotnet tool restore
dotnet restore
dotnet fable
- Open the generated file
Program.fs.js
- Note
import { IErrorInterface } from "./Source.fs.js";
. This is the line causing the error.
This bug is not present in Fable 4.1.2.
In Program.fs
, you can comment out the type ErrorUnion
and uncomment the other types above it. If you run dotnet fable
again, the bug is not present in the generated file.