Skip to content

fix(all): pass raw value for optional arguments of native bindings#4688

Merged
MangelMaxime merged 1 commit into
mainfrom
feat/erase-option-wrapping-from-binding-calls
Jun 25, 2026
Merged

fix(all): pass raw value for optional arguments of native bindings#4688
MangelMaxime merged 1 commit into
mainfrom
feat/erase-option-wrapping-from-binding-calls

Conversation

@MangelMaxime

Copy link
Copy Markdown
Member

The need for this optimization is coming from TypeScript because in scenario like

 export function prettyPrint(space: int32, value: any): string {
      return JSON.stringify(value, undefined, some(space));
      //                                      ^^^^^^^^^^^  wraps in Fable Option
  }

some(space) is not able to resolve to string | number because it is inferred as Option<int32>

The optimization is not able to pick up all the external calls. For example, in Fable interface are erased by default and considered external calls by default.

But if people want to opt-in for this optimization they can add [<Erase>] attribute to it.

@MangelMaxime MangelMaxime force-pushed the feat/erase-option-wrapping-from-binding-calls branch from 740272b to 0e32793 Compare June 25, 2026 18:09
@MangelMaxime MangelMaxime merged commit a4c7548 into main Jun 25, 2026
44 of 45 checks passed
@MangelMaxime MangelMaxime deleted the feat/erase-option-wrapping-from-binding-calls branch June 25, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant