[js_interop_gen] Deduplicate `UnionType` and `IntersectionType` via `UnionOrIntersectionType` (#578)

* [js_interop_gen] Deduplicate `UnionType` and `IntersectionType` via `UnionOrIntersectionType`

Stacked on #577.

- Extract `sealed class UnionOrIntersectionType extends DeclarationType` in
  `lib/src/ast/types.dart` (mirroring `_UnionOrIntersectionDeclaration`) to
  share `types`, `isNullable`, `declarationName`, `id`, `emit()`, `hashCode`,
  and `operator ==` across `UnionType` and `IntersectionType` (`pkg:dedupe`
  `cluster-47`).
- Fix `UnionType.==` and `IntersectionType.==`, which previously checked
  `other is TupleType` due to copy-paste.
- Consolidate `UnionType` / `IntersectionType` pattern cases in
  `lib/src/ast/helpers.dart` and
  `lib/src/interop_gen/transform/dependency_walker.dart`.
- Write `dart_main.js` via an atomic temporary file rename in
  `compileDartMain()` (`lib/src/cli.dart`) so parallel `dart test` isolates in
  the same VM process cannot truncate `dart_main.js` while `node main.mjs` is
  loading it.

* Enforce symmetric equality and length check in UnionOrIntersectionType.==
3 files changed
tree: bdfc0c7aa56f0278bdedaa0ce0cbf7ca817cd1a9
  1. .github/
  2. js_interop/
  3. js_interop_gen/
  4. third_party/
  5. web/
  6. web_generator/
  7. .gitignore
  8. LICENSE
  9. README.md
README.md
PackageDescriptionVersionCI
webLightweight browser API bindings built around JS interop.pub packagepackage:web
js_interopUtility functions and types for dart:js_interop and dart:js_interop_unsafe.pub packagepackage:js_interop
js_interop_genTools to generate Dart interfaces from TypeScript declaration files and Web IDL definitions.N/Apackage:js_interop_gen
web_generatorInternal tooling to generate the web package bindings.N/Apackage:web_generator