From 07eb5da84531d9f675e4c8eb95b577c964351f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Raddum=20Berg?= Date: Thu, 29 Sep 2022 23:09:26 +0200 Subject: [PATCH] modules: don't re-export synthetic expanded classes into new modules. Fixes #471 --- .../check-3/e/eventemitter3/project/build.properties | 1 + tests/pixi.js/check-3/e/eventemitter3/project/plugins.sbt | 1 + tests/pixi.js/check-3/p/pixi__utils/build.sbt | 2 +- .../pixi.js/check-3/p/pixi__utils/project/build.properties | 1 + tests/pixi.js/check-3/p/pixi__utils/project/plugins.sbt | 1 + .../pixi__utils/src/main/scala/typings/pixiUtils/mod.scala | 5 +++-- tests/pixi.js/check-3/p/pixi_dot_js/build.sbt | 4 ++-- .../pixi.js/check-3/p/pixi_dot_js/project/build.properties | 1 + tests/pixi.js/check-3/p/pixi_dot_js/project/plugins.sbt | 1 + .../p/pixi_dot_js/src/main/scala/typings/pixiJs/mod.scala | 7 ++++--- .../converter/internal/ts/modules/DeriveCopy.scala | 4 ++++ 11 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 tests/pixi.js/check-3/e/eventemitter3/project/build.properties create mode 100644 tests/pixi.js/check-3/e/eventemitter3/project/plugins.sbt create mode 100644 tests/pixi.js/check-3/p/pixi__utils/project/build.properties create mode 100644 tests/pixi.js/check-3/p/pixi__utils/project/plugins.sbt create mode 100644 tests/pixi.js/check-3/p/pixi_dot_js/project/build.properties create mode 100644 tests/pixi.js/check-3/p/pixi_dot_js/project/plugins.sbt diff --git a/tests/pixi.js/check-3/e/eventemitter3/project/build.properties b/tests/pixi.js/check-3/e/eventemitter3/project/build.properties new file mode 100644 index 0000000000..b1e589d9f4 --- /dev/null +++ b/tests/pixi.js/check-3/e/eventemitter3/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.7.1 \ No newline at end of file diff --git a/tests/pixi.js/check-3/e/eventemitter3/project/plugins.sbt b/tests/pixi.js/check-3/e/eventemitter3/project/plugins.sbt new file mode 100644 index 0000000000..efff5a7004 --- /dev/null +++ b/tests/pixi.js/check-3/e/eventemitter3/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.10.0") diff --git a/tests/pixi.js/check-3/p/pixi__utils/build.sbt b/tests/pixi.js/check-3/p/pixi__utils/build.sbt index 02261eaa1e..df403ca168 100644 --- a/tests/pixi.js/check-3/p/pixi__utils/build.sbt +++ b/tests/pixi.js/check-3/p/pixi__utils/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "pixi__utils" -version := "0.0-unknown-98d092" +version := "0.0-unknown-05e0f6" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/pixi.js/check-3/p/pixi__utils/project/build.properties b/tests/pixi.js/check-3/p/pixi__utils/project/build.properties new file mode 100644 index 0000000000..b1e589d9f4 --- /dev/null +++ b/tests/pixi.js/check-3/p/pixi__utils/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.7.1 \ No newline at end of file diff --git a/tests/pixi.js/check-3/p/pixi__utils/project/plugins.sbt b/tests/pixi.js/check-3/p/pixi__utils/project/plugins.sbt new file mode 100644 index 0000000000..efff5a7004 --- /dev/null +++ b/tests/pixi.js/check-3/p/pixi__utils/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.10.0") diff --git a/tests/pixi.js/check-3/p/pixi__utils/src/main/scala/typings/pixiUtils/mod.scala b/tests/pixi.js/check-3/p/pixi__utils/src/main/scala/typings/pixiUtils/mod.scala index 25da9408c0..f2a1117c45 100644 --- a/tests/pixi.js/check-3/p/pixi__utils/src/main/scala/typings/pixiUtils/mod.scala +++ b/tests/pixi.js/check-3/p/pixi__utils/src/main/scala/typings/pixiUtils/mod.scala @@ -29,10 +29,11 @@ object mod { val EventEmitter: EventEmitterStatic = js.native /* This class was inferred from a value with a constructor, it was renamed because a distinct type already exists with the same name. */ - @JSImport("@pixi/utils", "EventEmitter.EventEmitterCls") + @JSImport("@pixi/utils", "EventEmitter.EventEmitter") @js.native open class EventEmitterCls[EventTypes] () - extends typings.eventemitter3.mod.EventEmitterCls[EventTypes] + extends StObject + with typings.eventemitter3.mod.EventEmitter[EventTypes] type _To = js.Object & EventEmitterStatic diff --git a/tests/pixi.js/check-3/p/pixi_dot_js/build.sbt b/tests/pixi.js/check-3/p/pixi_dot_js/build.sbt index f9dff1779d..d0a99fc837 100644 --- a/tests/pixi.js/check-3/p/pixi_dot_js/build.sbt +++ b/tests/pixi.js/check-3/p/pixi_dot_js/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "pixi_dot_js" -version := "0.0-unknown-3024a5" +version := "0.0-unknown-ba7eae" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "org.scalablytyped" %%% "eventemitter3" % "0.0-unknown-292498", - "org.scalablytyped" %%% "pixi__utils" % "0.0-unknown-98d092") + "org.scalablytyped" %%% "pixi__utils" % "0.0-unknown-05e0f6") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") licenses += ("MIT", url("http://opensource.org/licenses/MIT")) diff --git a/tests/pixi.js/check-3/p/pixi_dot_js/project/build.properties b/tests/pixi.js/check-3/p/pixi_dot_js/project/build.properties new file mode 100644 index 0000000000..b1e589d9f4 --- /dev/null +++ b/tests/pixi.js/check-3/p/pixi_dot_js/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.7.1 \ No newline at end of file diff --git a/tests/pixi.js/check-3/p/pixi_dot_js/project/plugins.sbt b/tests/pixi.js/check-3/p/pixi_dot_js/project/plugins.sbt new file mode 100644 index 0000000000..efff5a7004 --- /dev/null +++ b/tests/pixi.js/check-3/p/pixi_dot_js/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.10.0") diff --git a/tests/pixi.js/check-3/p/pixi_dot_js/src/main/scala/typings/pixiJs/mod.scala b/tests/pixi.js/check-3/p/pixi_dot_js/src/main/scala/typings/pixiJs/mod.scala index 98c4de98c0..f52db46e6c 100644 --- a/tests/pixi.js/check-3/p/pixi_dot_js/src/main/scala/typings/pixiJs/mod.scala +++ b/tests/pixi.js/check-3/p/pixi_dot_js/src/main/scala/typings/pixiJs/mod.scala @@ -21,7 +21,7 @@ object mod { @js.native open class ^[EventTypes] () extends StObject - with typings.pixiUtils.mod.^[EventTypes] + with typings.eventemitter3.mod.EventEmitter[EventTypes] @JSImport("pixi.js", "utils.EventEmitter") @js.native @@ -31,10 +31,11 @@ object mod { val EventEmitter: EventEmitterStatic = js.native /* This class was inferred from a value with a constructor, it was renamed because a distinct type already exists with the same name. */ - @JSImport("pixi.js", "utils.EventEmitter.EventEmitterCls") + @JSImport("pixi.js", "utils.EventEmitter.EventEmitter") @js.native open class EventEmitterCls[EventTypes] () - extends typings.pixiUtils.mod.EventEmitter.EventEmitterCls[EventTypes] + extends StObject + with typings.eventemitter3.mod.EventEmitter[EventTypes] type _To = js.Object & EventEmitterStatic diff --git a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/modules/DeriveCopy.scala b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/modules/DeriveCopy.scala index 842855a548..ec6986038a 100644 --- a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/modules/DeriveCopy.scala +++ b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/modules/DeriveCopy.scala @@ -37,6 +37,10 @@ object DeriveCopy { val name = rename.getOrElse(origName) val derived = x match { + // these are synthetic, and should be re-expanded downstream + case _: TsDeclClass if x.comments.has[Marker.ExpandedClass.type] => + IArray.Empty + case x: TsDeclClass => IArray( x.copy(