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

[TS] Support [<Mangle>] on interface #3943

Merged
merged 2 commits into from
Oct 28, 2024
Merged

[TS] Support [<Mangle>] on interface #3943

merged 2 commits into from
Oct 28, 2024

Conversation

MangelMaxime
Copy link
Member

@MangelMaxime MangelMaxime commented Oct 26, 2024

Fix #3863

@ncave I was looking into fixing #3863 and manage to fix that specific case however, if the members as an argument different than unit then it doesn't work because that member should me mangled.

The difficulty is Mangle name computation happens during FSharp2Fable transformation, but for interfaces we don't do it.

How should we approach this problem? Should we try to add Mangle information for interface too which means making a changes to Fable.AST or can we recompute the Mangle / HashSuffix using FableEntity instead of FSharpEntity?

@ncave
Copy link
Collaborator

ncave commented Oct 27, 2024

@MangelMaxime Perhaps something like this? (untested, pseudo-code):

let overloadSuffix = memb.CurriedParameterGroups |> OverloadSuffix.getHash entGenParams
let memberName = memb.CompiledName + "_" + overloadSuffix

Maybe don't add suffix for getters or setters, and no "_" if suffix is empty.

@MangelMaxime
Copy link
Member Author

@ncave Thank you, you allowed me to go in the right direction.

This needs a bigger rewrite than I thought at first, but it seems doable. I am working on it.

Copy link
Collaborator

@ncave ncave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@MangelMaxime MangelMaxime merged commit dffde1a into main Oct 28, 2024
19 checks passed
@MangelMaxime MangelMaxime deleted the fix/ts_interface branch October 28, 2024 07:26
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.

[TypeScript] Mangled interfaces not created correctly
2 participants