diff --git a/cli/src/main/scala/org/scalablytyped/converter/cli/Main.scala b/cli/src/main/scala/org/scalablytyped/converter/cli/Main.scala index 1f0366100c..9b74e1d7b8 100644 --- a/cli/src/main/scala/org/scalablytyped/converter/cli/Main.scala +++ b/cli/src/main/scala/org/scalablytyped/converter/cli/Main.scala @@ -280,6 +280,7 @@ object Main { pedantic = false, enableScalaJsDefined = conversion.enableScalaJsDefined, outputPkg = conversion.outputPackage, + flavour = conversion.flavourImpl, ), "scala.js", ) diff --git a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase2ToScalaJs.scala b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase2ToScalaJs.scala index 7b32525b09..19c1e910cd 100644 --- a/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase2ToScalaJs.scala +++ b/importer-portable/src/main/scala/org/scalablytyped/converter/internal/importer/Phase2ToScalaJs.scala @@ -6,8 +6,16 @@ import com.olvind.logging.Logger import org.scalablytyped.converter.internal.importer.Phase1Res.{LibTs, LibraryPart} import org.scalablytyped.converter.internal.maps._ import org.scalablytyped.converter.internal.phases.{GetDeps, IsCircular, Phase, PhaseRes} +import org.scalablytyped.converter.internal.scalajs.flavours.FlavourImpl import org.scalablytyped.converter.internal.scalajs.transforms.{Adapter, CleanIllegalNames} -import org.scalablytyped.converter.internal.scalajs.{Name, PackageTree, ParentsResolver, TreeScope, transforms => S} +import org.scalablytyped.converter.internal.scalajs.{ + Name, + PackageTree, + ParentsResolver, + QualifiedName, + TreeScope, + transforms => S, +} import org.scalablytyped.converter.internal.ts.{TsIdentLibrary, TsTreeTraverse} import scala.collection.immutable.SortedSet @@ -16,8 +24,17 @@ import scala.collection.immutable.SortedSet * This phase starts by going from the typescript AST to the scala AST. * Then the phase itself implements a bunch of scala.js limitations, like ensuring no methods erase to the same signature */ -class Phase2ToScalaJs(pedantic: Boolean, enableScalaJsDefined: Selection[TsIdentLibrary], outputPkg: Name) - extends Phase[Source, Phase1Res, LibScalaJs] { +class Phase2ToScalaJs( + pedantic: Boolean, + enableScalaJsDefined: Selection[TsIdentLibrary], + outputPkg: Name, + flavour: FlavourImpl, +) extends Phase[Source, Phase1Res, LibScalaJs] { + + val willBeExternalTypes: Set[QualifiedName] = flavour.rewritesOpt match { + case Some(rewrites) => rewrites.conversionsForTypeName.keys.to[Set] + case None => Set() + } override def apply( source: Source, @@ -56,7 +73,7 @@ class Phase2ToScalaJs(pedantic: Boolean, enableScalaJsDefined: Selection[TsIdent cleanIllegalNames >> S.Deduplicator visitPackageTree scope, Adapter(scope)((tree, s) => S.FakeLiterals(outputPkg, s, cleanIllegalNames)(tree)), - Adapter(scope)((tree, s) => S.UnionToInheritance(s, tree, scalaName)), // after FakeLiterals + Adapter(scope)((tree, s) => S.UnionToInheritance(s, tree, scalaName, willBeExternalTypes)), // after FakeLiterals S.LimitUnionLength visitPackageTree scope, // after UnionToInheritance (S.AvoidMacroParadiseBug >> new S.RemoveMultipleInheritance(new ParentsResolver)) visitPackageTree scope, S.CombineOverloads visitPackageTree scope, //must have stable types, so FakeLiterals run before diff --git a/importer/src/main/scala/org/scalablytyped/converter/internal/importer/Ci.scala b/importer/src/main/scala/org/scalablytyped/converter/internal/importer/Ci.scala index 200037d699..316a5d9902 100644 --- a/importer/src/main/scala/org/scalablytyped/converter/internal/importer/Ci.scala +++ b/importer/src/main/scala/org/scalablytyped/converter/internal/importer/Ci.scala @@ -305,6 +305,7 @@ class Ci(config: Ci.Config, paths: Ci.Paths, publisher: Publisher, pool: ForkJoi config.pedantic, enableScalaJsDefined = config.conversion.enableScalaJsDefined, outputPkg = config.conversion.outputPackage, + flavour = config.conversion.flavourImpl, ), "scala.js", ) diff --git a/importer/src/test/scala/org/scalablytyped/converter/internal/importer/ImporterHarness.scala b/importer/src/test/scala/org/scalablytyped/converter/internal/importer/ImporterHarness.scala index 60b582c225..9a415dd74a 100644 --- a/importer/src/test/scala/org/scalablytyped/converter/internal/importer/ImporterHarness.scala +++ b/importer/src/test/scala/org/scalablytyped/converter/internal/importer/ImporterHarness.scala @@ -74,7 +74,12 @@ trait ImporterHarness extends AnyFunSuite { "typescript", ) .next( - new Phase2ToScalaJs(pedantic, enableScalaJsDefined = Selection.None, outputPkg = flavour.outputPkg), + new Phase2ToScalaJs( + pedantic, + enableScalaJsDefined = Selection.None, + outputPkg = flavour.outputPkg, + flavour = flavour, + ), "scala.js", ) .next(new PhaseFlavour(flavour), flavour.toString) diff --git a/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypings.scala b/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypings.scala index dafafa3c7c..a9801c2b59 100644 --- a/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypings.scala +++ b/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypings.scala @@ -79,6 +79,7 @@ object ImportTypings { pedantic = false, enableScalaJsDefined = input.conversion.enableScalaJsDefined, outputPkg = input.conversion.outputPackage, + flavour = input.conversion.flavourImpl, ), "scala.js", ) diff --git a/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypingsGenSources.scala b/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypingsGenSources.scala index c1806e46ee..710fd74534 100644 --- a/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypingsGenSources.scala +++ b/sbt-converter/src/main/scala/org/scalablytyped/converter/internal/ImportTypingsGenSources.scala @@ -66,9 +66,10 @@ object ImportTypingsGenSources { ) .next( new Phase2ToScalaJs( - pedantic = false, - input.conversion.enableScalaJsDefined, - outputPkg = conversion.outputPackage, + pedantic = false, + enableScalaJsDefined = input.conversion.enableScalaJsDefined, + outputPkg = conversion.outputPackage, + flavour = input.conversion.flavourImpl, ), "scala.js", ) diff --git a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/FlavourImpl.scala b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/FlavourImpl.scala index c55f0af844..4ec6c7c873 100644 --- a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/FlavourImpl.scala +++ b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/FlavourImpl.scala @@ -7,6 +7,8 @@ trait FlavourImpl { def dependencies: Set[Dep] val outputPkg: Name + val rewritesOpt: Option[CastConversion.TypeRewriterCast] + override val toString = getClass.getSimpleName } diff --git a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/JapgollyFlavour.scala b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/JapgollyFlavour.scala index a0793ef64b..c7f1d04452 100644 --- a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/JapgollyFlavour.scala +++ b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/JapgollyFlavour.scala @@ -24,4 +24,6 @@ case class JapgollyFlavour(outputPkg: Name, enableImplicitOps: Boolean) extends rewriter.visitPackageTree(scope)(withComponents) } + + override val rewritesOpt: Option[CastConversion.TypeRewriterCast] = Some(rewriter) } diff --git a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/NormalFlavour.scala b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/NormalFlavour.scala index 1bb4581242..d68fa30da1 100644 --- a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/NormalFlavour.scala +++ b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/NormalFlavour.scala @@ -13,17 +13,18 @@ case class NormalFlavour( override val dependencies = if (shouldUseScalaJsDomTypes) Set(Versions.scalaJsDom, Versions.runtime) else Set(Versions.runtime) - val rewriterOpt = if (shouldUseScalaJsDomTypes) Some(new TypeRewriterCast(scalaJsDomNames.All)) else None - val memberToProp = new MemberToProp.Default(rewriterOpt) - val findProps = new FindProps(new CleanIllegalNames(outputPkg), memberToProp, parentsResolver) - val genCompanions = new GenCompanions(findProps, enableImplicitOps) + override val rewritesOpt = if (shouldUseScalaJsDomTypes) Some(new TypeRewriterCast(scalaJsDomNames.All)) else None + val memberToProp = new MemberToProp.Default(rewritesOpt) + val findProps = new FindProps(new CleanIllegalNames(outputPkg), memberToProp, parentsResolver) + val genCompanions = new GenCompanions(findProps, enableImplicitOps) final override def rewrittenTree(scope: TreeScope, tree: PackageTree): PackageTree = { val withCompanions = genCompanions.visitPackageTree(scope)(tree) - rewriterOpt match { + rewritesOpt match { case Some(rewriter) => rewriter.visitPackageTree(scope)(withCompanions) case _ => withCompanions } } + } diff --git a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyFlavour.scala b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyFlavour.scala index 5391e36175..bc0e09cd0c 100644 --- a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyFlavour.scala +++ b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyFlavour.scala @@ -48,4 +48,6 @@ case class SlinkyFlavour(outputPkg: Name, enableImplicitOps: Boolean) extends Fl rewriter.visitPackageTree(scope)(withComponents) } + + override val rewritesOpt: Option[CastConversion.TypeRewriterCast] = Some(rewriter) } diff --git a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyNativeFlavour.scala b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyNativeFlavour.scala index 227fc99840..05984aa16d 100644 --- a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyNativeFlavour.scala +++ b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/flavours/SlinkyNativeFlavour.scala @@ -34,4 +34,6 @@ case class SlinkyNativeFlavour(outputPkg: Name, enableImplicitOps: Boolean) exte rewriter.visitPackageTree(scope)(withComponents) } + + override val rewritesOpt: Option[CastConversion.TypeRewriterCast] = Some(rewriter) } diff --git a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/UnionToInheritance.scala b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/UnionToInheritance.scala index 75344e0684..0079631c8b 100644 --- a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/UnionToInheritance.scala +++ b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/UnionToInheritance.scala @@ -69,8 +69,13 @@ package transforms object UnionToInheritance { final case class WasUnion(related: IArray[TypeRef]) extends Comment.Data - def apply(scope: TreeScope, tree: ContainerTree, inLib: Name): ContainerTree = { - val rewrites = Rewrite.identify(inLib, tree, scope / tree) + def apply( + scope: TreeScope, + tree: ContainerTree, + inLib: Name, + willBeExternalTypes: Set[QualifiedName], + ): ContainerTree = { + val rewrites = Rewrite.identify(inLib, tree, scope / tree, willBeExternalTypes) val newParentsByCodePath: Map[QualifiedName, IArray[InvertingTypeParamRef]] = rewrites @@ -181,7 +186,12 @@ object UnionToInheritance { final case class Rewrite(original: TypeAliasTree, asInheritance: IArray[TypeRef], unchanged: IArray[TypeRef]) object Rewrite { - def identify(inLib: Name, p: ContainerTree, scope: TreeScope): IArray[Rewrite] = { + def identify( + inLib: Name, + p: ContainerTree, + scope: TreeScope, + willBeExternalTypes: Set[QualifiedName], + ): IArray[Rewrite] = { def go(p: ContainerTree, scope: TreeScope): IArray[Rewrite] = { def legalClassName(name: Name): Boolean = p index name forall { @@ -189,8 +199,9 @@ object UnionToInheritance { case _ => true } p.members.flatMap { - case p: ContainerTree => identify(inLib, p, scope / p) - case ta: TypeAliasTree if legalClassName(ta.name) => IArray.fromOption(canRewrite(inLib, ta, scope / ta)) + case p: ContainerTree => identify(inLib, p, scope / p, willBeExternalTypes) + case ta: TypeAliasTree if legalClassName(ta.name) => + IArray.fromOption(canRewrite(inLib, ta, scope / ta, willBeExternalTypes)) case _ => Empty } } @@ -213,15 +224,22 @@ object UnionToInheritance { all.map(r => r.copy(unchanged = r.unchanged ++ r.asInheritance.map(_.typeName).flatMap(go).distinct)) } - def canRewrite(inLib: Name, ta: TypeAliasTree, scope: TreeScope): Option[Rewrite] = + def canRewrite( + inLib: Name, + ta: TypeAliasTree, + scope: TreeScope, + willBeExternalTypes: Set[QualifiedName], + ): Option[Rewrite] = ta.alias match { case TypeRef.Union(types, _) => def legalTarget(tr: TypeRef): Boolean = - scope.lookup(tr.typeName).exists { - case (_: ClassTree, _) => true - case (ta: TypeAliasTree, _) => canRewrite(inLib, ta, scope).isDefined - case _ => false - } + if (willBeExternalTypes(tr.typeName)) false + else + scope.lookup(tr.typeName).exists { + case (_: ClassTree, _) => true + case (ta: TypeAliasTree, _) => canRewrite(inLib, ta, scope, willBeExternalTypes).isDefined + case _ => false + } val InLibrary: PartialFunction[TypeRef, TypeRef] = { case tr @ TypeRef(QualifiedName(parts), _, _) diff --git a/tests/material-ui/check-japgolly/m/material-ui/build.sbt b/tests/material-ui/check-japgolly/m/material-ui/build.sbt index 2fda325db8..25b7d3c261 100644 --- a/tests/material-ui/check-japgolly/m/material-ui/build.sbt +++ b/tests/material-ui/check-japgolly/m/material-ui/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "material-ui" -version := "0.0-unknown-1631b3" +version := "0.0-unknown-ff1022" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "1.7.0", "com.olvind" %%% "scalablytyped-runtime" % "2.1.0", - "org.scalablytyped" %%% "react" % "0.0-unknown-fdf042", + "org.scalablytyped" %%% "react" % "0.0-unknown-1c8110", "org.scalablytyped" %%% "std" % "0.0-unknown-7244e3") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials") diff --git a/tests/material-ui/check-japgolly/r/react/build.sbt b/tests/material-ui/check-japgolly/r/react/build.sbt index 60024276e9..241e788dd1 100644 --- a/tests/material-ui/check-japgolly/r/react/build.sbt +++ b/tests/material-ui/check-japgolly/r/react/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react" -version := "0.0-unknown-fdf042" +version := "0.0-unknown-1c8110" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala b/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala index 14f96f3bde..7b7f4569ae 100644 --- a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala +++ b/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala @@ -9,8 +9,7 @@ import scala.scalajs.js.annotation._ @js.native trait ComponentClass[P] - extends ComponentType[P] - with Instantiable1[ + extends Instantiable1[ /* props */ P, japgolly.scalajs.react.raw.React.Component[P with js.Object, js.Object] ] diff --git a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentType.scala b/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentType.scala deleted file mode 100644 index 2c0a8a2980..0000000000 --- a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentType.scala +++ /dev/null @@ -1,12 +0,0 @@ -package typingsJapgolly.react.mod - -import scala.scalajs.js -import scala.scalajs.js.`|` -import scala.scalajs.js.annotation._ - -/* Rewritten from type alias, can be one of: - - typingsJapgolly.react.mod.ComponentClass[P] - - typingsJapgolly.react.mod.StatelessComponent[P] -*/ -trait ComponentType[P] extends js.Object - diff --git a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala b/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala index d8d651a928..b06f63162f 100644 --- a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala +++ b/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala @@ -8,7 +8,7 @@ import scala.scalajs.js.`|` import scala.scalajs.js.annotation._ @js.native -trait StatelessComponent[P] extends ComponentType[P] { +trait StatelessComponent[P] extends js.Object { var defaultProps: js.UndefOr[Partial[P]] = js.native var displayName: js.UndefOr[String] = js.native def apply(props: P with Children): Element | Null = js.native diff --git a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala b/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala index a241f2f216..27a2430720 100644 --- a/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala +++ b/tests/material-ui/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala @@ -6,6 +6,7 @@ import scala.scalajs.js.annotation._ package object mod { type ComponentState = js.Object + type ComponentType[P] = (japgolly.scalajs.react.raw.React.ComponentClassP[P with js.Object]) | typingsJapgolly.react.mod.StatelessComponent[P] type Key = java.lang.String | scala.Double type ReactNode = js.UndefOr[java.lang.String | scala.Double | scala.Boolean] type SFC[P] = typingsJapgolly.react.mod.StatelessComponent[P] diff --git a/tests/material-ui/check-slinky/m/material-ui/build.sbt b/tests/material-ui/check-slinky/m/material-ui/build.sbt index 26fd7bd338..a5591f52ae 100644 --- a/tests/material-ui/check-slinky/m/material-ui/build.sbt +++ b/tests/material-ui/check-slinky/m/material-ui/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "material-ui" -version := "0.0-unknown-9a6db6" +version := "0.0-unknown-3ac7af" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.1.0", "me.shadaj" %%% "slinky-web" % "0.6.5", - "org.scalablytyped" %%% "react" % "0.0-unknown-726a4c", + "org.scalablytyped" %%% "react" % "0.0-unknown-c6c500", "org.scalablytyped" %%% "std" % "0.0-unknown-e37381") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials") diff --git a/tests/material-ui/check-slinky/r/react/build.sbt b/tests/material-ui/check-slinky/r/react/build.sbt index 4bca9c3a35..6071893df4 100644 --- a/tests/material-ui/check-slinky/r/react/build.sbt +++ b/tests/material-ui/check-slinky/r/react/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react" -version := "0.0-unknown-726a4c" +version := "0.0-unknown-c6c500" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala b/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala index 7a0ddfe8b2..6a81dc3eb7 100644 --- a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala +++ b/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala @@ -10,8 +10,7 @@ import scala.scalajs.js.annotation._ @js.native trait ComponentClass[P] - extends ComponentType[P] - with Instantiable1[/* props */ P, ReactComponentClass[P]] + extends Instantiable1[/* props */ P, ReactComponentClass[P]] with Instantiable2[/* props */ P, /* context */ js.Any, ReactComponentClass[P]] { var defaultProps: js.UndefOr[Partial[P]] = js.native var displayName: js.UndefOr[String] = js.native diff --git a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentType.scala b/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentType.scala deleted file mode 100644 index cc27ba37a1..0000000000 --- a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentType.scala +++ /dev/null @@ -1,12 +0,0 @@ -package typingsSlinky.react.mod - -import scala.scalajs.js -import scala.scalajs.js.`|` -import scala.scalajs.js.annotation._ - -/* Rewritten from type alias, can be one of: - - typingsSlinky.react.mod.ComponentClass[P] - - typingsSlinky.react.mod.StatelessComponent[P] -*/ -trait ComponentType[P] extends js.Object - diff --git a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala b/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala index 15b72ca76e..c86675a23a 100644 --- a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala +++ b/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala @@ -7,7 +7,7 @@ import scala.scalajs.js.`|` import scala.scalajs.js.annotation._ @js.native -trait StatelessComponent[P] extends ComponentType[P] { +trait StatelessComponent[P] extends js.Object { var defaultProps: js.UndefOr[Partial[P]] = js.native var displayName: js.UndefOr[String] = js.native def apply(props: P with Children): slinky.core.facade.ReactElement | Null = js.native diff --git a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala b/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala index e004c02642..5e7a8e7400 100644 --- a/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala +++ b/tests/material-ui/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala @@ -6,6 +6,7 @@ import scala.scalajs.js.annotation._ package object mod { type ComponentState = js.Object + type ComponentType[P] = slinky.core.ReactComponentClass[P] type Key = java.lang.String | scala.Double type ReactNode = js.UndefOr[java.lang.String | scala.Double | scala.Boolean] type SFC[P] = slinky.core.ReactComponentClass[P] diff --git a/tests/react-transition-group/check-japgolly/r/react-transition-group/build.sbt b/tests/react-transition-group/check-japgolly/r/react-transition-group/build.sbt index fc500a065a..b734d0bbc4 100644 --- a/tests/react-transition-group/check-japgolly/r/react-transition-group/build.sbt +++ b/tests/react-transition-group/check-japgolly/r/react-transition-group/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-transition-group" -version := "2.0-6ecb64" +version := "2.0-d7d8f4" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "1.7.0", "com.olvind" %%% "scalablytyped-runtime" % "2.1.0", - "org.scalablytyped" %%% "react" % "0.0-unknown-267232", + "org.scalablytyped" %%% "react" % "0.0-unknown-f1f1a5", "org.scalablytyped" %%% "std" % "0.0-unknown-a4120e") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials") diff --git a/tests/react-transition-group/check-japgolly/r/react/build.sbt b/tests/react-transition-group/check-japgolly/r/react/build.sbt index 090b60ed5c..8f95f2fd95 100644 --- a/tests/react-transition-group/check-japgolly/r/react/build.sbt +++ b/tests/react-transition-group/check-japgolly/r/react/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react" -version := "0.0-unknown-267232" +version := "0.0-unknown-f1f1a5" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala b/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala index 14f96f3bde..7b7f4569ae 100644 --- a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala +++ b/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentClass.scala @@ -9,8 +9,7 @@ import scala.scalajs.js.annotation._ @js.native trait ComponentClass[P] - extends ComponentType[P] - with Instantiable1[ + extends Instantiable1[ /* props */ P, japgolly.scalajs.react.raw.React.Component[P with js.Object, js.Object] ] diff --git a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentType.scala b/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentType.scala deleted file mode 100644 index 2c0a8a2980..0000000000 --- a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/ComponentType.scala +++ /dev/null @@ -1,12 +0,0 @@ -package typingsJapgolly.react.mod - -import scala.scalajs.js -import scala.scalajs.js.`|` -import scala.scalajs.js.annotation._ - -/* Rewritten from type alias, can be one of: - - typingsJapgolly.react.mod.ComponentClass[P] - - typingsJapgolly.react.mod.StatelessComponent[P] -*/ -trait ComponentType[P] extends js.Object - diff --git a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala b/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala index d8d651a928..b06f63162f 100644 --- a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala +++ b/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/StatelessComponent.scala @@ -8,7 +8,7 @@ import scala.scalajs.js.`|` import scala.scalajs.js.annotation._ @js.native -trait StatelessComponent[P] extends ComponentType[P] { +trait StatelessComponent[P] extends js.Object { var defaultProps: js.UndefOr[Partial[P]] = js.native var displayName: js.UndefOr[String] = js.native def apply(props: P with Children): Element | Null = js.native diff --git a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala b/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala index 5568fa865c..63e489dc1e 100644 --- a/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala +++ b/tests/react-transition-group/check-japgolly/r/react/src/main/scala/typingsJapgolly/react/mod/package.scala @@ -6,6 +6,7 @@ import scala.scalajs.js.annotation._ package object mod { type ComponentState = js.Object + type ComponentType[P] = (japgolly.scalajs.react.raw.React.ComponentClassP[P with js.Object]) | typingsJapgolly.react.mod.StatelessComponent[P] type DetailedHTMLProps[E /* <: typingsJapgolly.react.mod.HTMLAttributes[T] */, T] = typingsJapgolly.react.mod.ClassAttributes[T] with E type Key = java.lang.String | scala.Double type NativeAnimationEvent = org.scalajs.dom.raw.AnimationEvent diff --git a/tests/react-transition-group/check-slinky/r/react-transition-group/build.sbt b/tests/react-transition-group/check-slinky/r/react-transition-group/build.sbt index a76048243b..46103647e8 100644 --- a/tests/react-transition-group/check-slinky/r/react-transition-group/build.sbt +++ b/tests/react-transition-group/check-slinky/r/react-transition-group/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-transition-group" -version := "2.0-daf197" +version := "2.0-c1ee01" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.1.0", "me.shadaj" %%% "slinky-web" % "0.6.5", - "org.scalablytyped" %%% "react" % "0.0-unknown-9b5fb6", + "org.scalablytyped" %%% "react" % "0.0-unknown-4a6b2b", "org.scalablytyped" %%% "std" % "0.0-unknown-a14703") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-g:notailcalls", "-language:implicitConversions", "-language:higherKinds", "-language:existentials") diff --git a/tests/react-transition-group/check-slinky/r/react/build.sbt b/tests/react-transition-group/check-slinky/r/react/build.sbt index 7291dd1a41..9e5d8cbcf7 100644 --- a/tests/react-transition-group/check-slinky/r/react/build.sbt +++ b/tests/react-transition-group/check-slinky/r/react/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react" -version := "0.0-unknown-9b5fb6" +version := "0.0-unknown-4a6b2b" scalaVersion := "2.13.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala b/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala index 7a0ddfe8b2..6a81dc3eb7 100644 --- a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala +++ b/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentClass.scala @@ -10,8 +10,7 @@ import scala.scalajs.js.annotation._ @js.native trait ComponentClass[P] - extends ComponentType[P] - with Instantiable1[/* props */ P, ReactComponentClass[P]] + extends Instantiable1[/* props */ P, ReactComponentClass[P]] with Instantiable2[/* props */ P, /* context */ js.Any, ReactComponentClass[P]] { var defaultProps: js.UndefOr[Partial[P]] = js.native var displayName: js.UndefOr[String] = js.native diff --git a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentType.scala b/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentType.scala deleted file mode 100644 index cc27ba37a1..0000000000 --- a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/ComponentType.scala +++ /dev/null @@ -1,12 +0,0 @@ -package typingsSlinky.react.mod - -import scala.scalajs.js -import scala.scalajs.js.`|` -import scala.scalajs.js.annotation._ - -/* Rewritten from type alias, can be one of: - - typingsSlinky.react.mod.ComponentClass[P] - - typingsSlinky.react.mod.StatelessComponent[P] -*/ -trait ComponentType[P] extends js.Object - diff --git a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala b/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala index 15b72ca76e..c86675a23a 100644 --- a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala +++ b/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/StatelessComponent.scala @@ -7,7 +7,7 @@ import scala.scalajs.js.`|` import scala.scalajs.js.annotation._ @js.native -trait StatelessComponent[P] extends ComponentType[P] { +trait StatelessComponent[P] extends js.Object { var defaultProps: js.UndefOr[Partial[P]] = js.native var displayName: js.UndefOr[String] = js.native def apply(props: P with Children): slinky.core.facade.ReactElement | Null = js.native diff --git a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala b/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala index 892c72694a..fce29459a5 100644 --- a/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala +++ b/tests/react-transition-group/check-slinky/r/react/src/main/scala/typingsSlinky/react/mod/package.scala @@ -6,6 +6,7 @@ import scala.scalajs.js.annotation._ package object mod { type ComponentState = js.Object + type ComponentType[P] = slinky.core.ReactComponentClass[P] type DetailedHTMLProps[E /* <: typingsSlinky.react.mod.HTMLAttributes[T] */, T] = typingsSlinky.react.mod.ClassAttributes[T] with E type Key = java.lang.String | scala.Double type NativeAnimationEvent = org.scalajs.dom.raw.AnimationEvent