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

Revisit outputting TypeScript declarations #1326

Open
Jand42 opened this issue Mar 30, 2023 · 0 comments
Open

Revisit outputting TypeScript declarations #1326

Jand42 opened this issue Mar 30, 2023 · 0 comments
Assignees
Projects

Comments

@Jand42
Copy link
Member

Jand42 commented Mar 30, 2023

TypeScript declarations for WebSharper 7 need some more work, these are some things to fix:

  • Make interface methods with default inline implementations optional in .d.ts. For example IEnumerable.GetEnumerator is proxied as such that it translates to a call to a Get0 method which checks first if object has GetEnumerator0, if not it uses GetEnumerator. This allows simplifying usual scenario where the two methods would return the same anyways, while simplifying runtime JS represenatation by having only GetEnumerator(). It could be argued that the two could be merged completely.

image

* Resolve import names to not collide with interface definition name, add generics. For example for generic `IEnumerable`:

image

* unions: if type translates to a plain object, with potential null/constant cases, export the full type shape as default, id lookup issues

image

* unions: if type translates to a class, create a `_T` type alias that is an intersection of the class type and the union cases:

image

@granicz granicz changed the title TypeScript decalarations Revisit outputting TypeScript declarations Apr 3, 2023
Jand42 added a commit that referenced this issue Apr 10, 2023
Jand42 added a commit that referenced this issue Apr 15, 2023
Jand42 added a commit that referenced this issue Apr 15, 2023
Jand42 added a commit that referenced this issue May 2, 2023
Jand42 added a commit that referenced this issue May 8, 2023
@granicz granicz added this to v7.0 in Releases May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant