You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When targeting Typescript mutable fields on structs cause the struct to be wraped in FSharpRef<_> , but then the access to the field fails to compile
This happens only when there is mutable after val
[<Struct>]typeR=val mutableX:floatnew(x: float)={ X = x }memberthis.IsEmpty()=// emits invalid TS// Property 'X' does not exist on type 'FSharpRef<Rt>'.
this.X <0.0
compiles to
exportclassRextendsRecordimplementsIEquatable<R>,IComparable<R>{X: float64;constructor(X: float64){super();this.X=X;}}exportfunctionR__IsEmpty(this$: FSharpRef<R>): boolean{returnthis$.X<0;// Property 'X' does not exist on type 'FSharpRef<Rt>'.}
Activity
[TS] Fix invalid thisArg argument type in structs (fable-compiler#4453)
[TS/Python] Fix invalid `this` argument type in structs (fable-compil…
[TS/Python] Fix invalid `this` argument type in structs (fable-compil…
[TS/Python] Fix invalid `this` argument type in structs (#4453) (#4454)
goswinr commentedon Mar 30, 2026
thanks @ncave for the quick fix,
I tested 142afe4 .
this works for members, but still errors on
overridelikethis.ToString()still emits
FSharpRef<_>[TS/Python] Fix thisArg type for overloads in structs (#4453) (#4466)
ncave commentedon Mar 30, 2026
@goswinr Thanks for contributing the issue. Fixed in #4466.