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.
Resolve import names to not collide with interface definition name, add generics. For example for generic IEnumerable:
unions: if type translates to a plain object, with potential null/constant cases, export the full type shape as default, id lookup issues
unions: if type translates to a class, create a _T type alias that is an intersection of the class type and the union cases:
TypeScript declarations for WebSharper 7 need some more work, these are some things to fix:
IEnumerable.GetEnumerator
is proxied as such that it translates to a call to aGet0
method which checks first if object hasGetEnumerator0
, if not it usesGetEnumerator
. This allows simplifying usual scenario where the two methods would return the same anyways, while simplifying runtime JS represenatation by having onlyGetEnumerator()
. It could be argued that the two could be merged completely.IEnumerable
:_T
type alias that is an intersection of the class type and the union cases: