HaxeFoundation / HaxeFoundation/haxe
HTML externs, improve type unions
Open
platform-javascript
type-system
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
If a type union has nested `EitherType`s then we can have unification issues, for example (from @SlavaRa's PR #7593)
```haxe
typedef BlobPart = Array<
haxe.extern.EitherType<
haxe.extern.EitherType<
ArrayBufferView,
ArrayBuffer
>,
haxe.extern.EitherType
>
>;
var arrayBuffers = [new ArrayBuffer()];
var x: Array = arrayBuffers;
```
To fix we can create an abstract for each type union that merges all `EitherType`s:
```haxe
abstract BlobPart(Dynamic)
from ArrayBufferView to ArrayBufferView
from ArrayBuffer to ArrayBuffer
from Blob to Blob
from String to String
{}
```
Contributor guide
Assessment
This issue has not been assessed yet.