From 10e2ae1a2eceef548da554c0c89263066e1709c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Raddum=20Berg?= Date: Mon, 17 Oct 2022 23:42:04 +0200 Subject: [PATCH] ExtractInterfaces: don't extract interfaces from inside conditional types --- .../c/componentstest/build.sbt | 4 +- .../r/react-bootstrap/build.sbt | 4 +- .../r/react-contextmenu/build.sbt | 4 +- .../r/react-dropzone/build.sbt | 4 +- .../r/react-markdown/build.sbt | 4 +- .../check-japgolly-3/r/react-select/build.sbt | 4 +- .../check-japgolly-3/r/react/build.sbt | 2 +- .../scala/typingsJapgolly/react/anon.scala | 101 ------------------ .../react/mod/FunctionComponentElement.scala | 4 +- .../react/mod/PropsWithRef.scala | 2 +- .../react/mod/ReactManagedAttributes.scala | 2 +- .../s/semantic-ui-react/build.sbt | 4 +- .../build.sbt | 4 +- .../build.sbt | 4 +- .../check-slinky-3/c/componentstest/build.sbt | 4 +- .../r/react-bootstrap/build.sbt | 4 +- .../r/react-contextmenu/build.sbt | 4 +- .../check-slinky-3/r/react-dropzone/build.sbt | 4 +- .../check-slinky-3/r/react-markdown/build.sbt | 4 +- .../check-slinky-3/r/react-select/build.sbt | 4 +- .../check-slinky-3/r/react/build.sbt | 2 +- .../main/scala/typingsSlinky/react/anon.scala | 101 ------------------ .../react/mod/FunctionComponentElement.scala | 4 +- .../react/mod/PropsWithRef.scala | 2 +- .../react/mod/ReactManagedAttributes.scala | 2 +- .../s/semantic-ui-react/build.sbt | 4 +- .../build.sbt | 4 +- .../build.sbt | 4 +- .../ts/transforms/ExtractInterfaces.scala | 10 +- 29 files changed, 53 insertions(+), 251 deletions(-) diff --git a/tests/react-integration-test/check-japgolly-3/c/componentstest/build.sbt b/tests/react-integration-test/check-japgolly-3/c/componentstest/build.sbt index 8882bcf934..5ecd24a2b2 100644 --- a/tests/react-integration-test/check-japgolly-3/c/componentstest/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/c/componentstest/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "componentstest" -version := "0.0-unknown-c856ab" +version := "0.0-unknown-282f31" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/r/react-bootstrap/build.sbt b/tests/react-integration-test/check-japgolly-3/r/react-bootstrap/build.sbt index 6c39ca50a3..c8a894e8e9 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-bootstrap/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/r/react-bootstrap/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-bootstrap" -version := "0.32-6eac56" +version := "0.32-f36d83" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/r/react-contextmenu/build.sbt b/tests/react-integration-test/check-japgolly-3/r/react-contextmenu/build.sbt index 9a4eb59c2d..938b7086fe 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-contextmenu/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/r/react-contextmenu/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-contextmenu" -version := "2.13.0-e70b6a" +version := "2.13.0-fc8fd3" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt index 503714fc6e..e95606f043 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/r/react-dropzone/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-dropzone" -version := "10.1.10-505392" +version := "10.1.10-ea1309" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/r/react-markdown/build.sbt b/tests/react-integration-test/check-japgolly-3/r/react-markdown/build.sbt index f336ef4d5a..6349b463a9 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-markdown/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/r/react-markdown/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-markdown" -version := "0.0-unknown-a12fbc" +version := "0.0-unknown-7eefe5" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/r/react-select/build.sbt b/tests/react-integration-test/check-japgolly-3/r/react-select/build.sbt index b84c214c7b..039ef3ee61 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react-select/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/r/react-select/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-select" -version := "0.0-unknown-685a3b" +version := "0.0-unknown-37de55" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/r/react/build.sbt b/tests/react-integration-test/check-japgolly-3/r/react/build.sbt index 71a87c2f82..a794e1f875 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/r/react/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react" -version := "16.9.2-89c3ae" +version := "16.9.2-f9dd03" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/anon.scala b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/anon.scala index 1d1a419250..d88e94f035 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/anon.scala +++ b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/anon.scala @@ -6,51 +6,12 @@ import japgolly.scalajs.react.facade.React.Element import japgolly.scalajs.react.facade.React.Node import japgolly.scalajs.react.vdom.VdomElement import japgolly.scalajs.react.vdom.VdomNode -import typingsJapgolly.std.Exclude import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} object anon { - trait `0`[R] extends StObject { - - var ref: js.UndefOr[Exclude[R, String]] = js.undefined - } - object `0` { - - inline def apply[R](): `0`[R] = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[`0`[R]] - } - - extension [Self <: `0`[?], R](x: Self & `0`[R]) { - - inline def setRef(value: Exclude[R, String]): Self = StObject.set(x, "ref", value.asInstanceOf[js.Any]) - - inline def setRefUndefined: Self = StObject.set(x, "ref", js.undefined) - } - } - - trait `1` extends StObject { - - var defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any - } - object `1` { - - inline def apply( - defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any - ): `1` = { - val __obj = js.Dynamic.literal(defaultProps = defaultProps.asInstanceOf[js.Any]) - __obj.asInstanceOf[`1`] - } - - extension [Self <: `1`](x: Self) { - - inline def setDefaultProps(value: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any): Self = StObject.set(x, "defaultProps", value.asInstanceOf[js.Any]) - } - } - trait Children extends StObject { var children: js.UndefOr[Node] = js.undefined @@ -76,30 +37,6 @@ object anon { } } - trait DefaultProps extends StObject { - - var defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any - - var propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any - } - object DefaultProps { - - inline def apply( - defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any, - propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any - ): DefaultProps = { - val __obj = js.Dynamic.literal(defaultProps = defaultProps.asInstanceOf[js.Any], propTypes = propTypes.asInstanceOf[js.Any]) - __obj.asInstanceOf[DefaultProps] - } - - extension [Self <: DefaultProps](x: Self) { - - inline def setDefaultProps(value: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any): Self = StObject.set(x, "defaultProps", value.asInstanceOf[js.Any]) - - inline def setPropTypes(value: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any): Self = StObject.set(x, "propTypes", value.asInstanceOf[js.Any]) - } - } - trait Html extends StObject { var __html: String @@ -116,42 +53,4 @@ object anon { inline def set__html(value: String): Self = StObject.set(x, "__html", value.asInstanceOf[js.Any]) } } - - trait PropTypes extends StObject { - - var propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any - } - object PropTypes { - - inline def apply(propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any): PropTypes = { - val __obj = js.Dynamic.literal(propTypes = propTypes.asInstanceOf[js.Any]) - __obj.asInstanceOf[PropTypes] - } - - extension [Self <: PropTypes](x: Self) { - - inline def setPropTypes(value: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any): Self = StObject.set(x, "propTypes", value.asInstanceOf[js.Any]) - } - } - - trait Ref extends StObject { - - var ref: js.UndefOr[ - /* import warning: importer.ImportType#apply Failed type conversion: infer R */ js.Any - ] = js.undefined - } - object Ref { - - inline def apply(): Ref = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[Ref] - } - - extension [Self <: Ref](x: Self) { - - inline def setRef(value: /* import warning: importer.ImportType#apply Failed type conversion: infer R */ js.Any): Self = StObject.set(x, "ref", value.asInstanceOf[js.Any]) - - inline def setRefUndefined: Self = StObject.set(x, "ref", js.undefined) - } - } } diff --git a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/FunctionComponentElement.scala b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/FunctionComponentElement.scala index 613da67031..08032e78ab 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/FunctionComponentElement.scala +++ b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/FunctionComponentElement.scala @@ -9,7 +9,7 @@ trait FunctionComponentElement[P] with ReactElement { var ref: js.UndefOr[ - /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends react.anon.Ref ? R : never : never */ js.Any + /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends { ref :infer R | undefined} ? R : never : never */ js.Any ] = js.undefined } object FunctionComponentElement { @@ -23,7 +23,7 @@ object FunctionComponentElement { extension [Self <: FunctionComponentElement[?], P](x: Self & FunctionComponentElement[P]) { inline def setRef( - value: /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends react.anon.Ref ? R : never : never */ js.Any + value: /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends { ref :infer R | undefined} ? R : never : never */ js.Any ): Self = StObject.set(x, "ref", value.asInstanceOf[js.Any]) inline def setRefUndefined: Self = StObject.set(x, "ref", js.undefined) diff --git a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/PropsWithRef.scala b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/PropsWithRef.scala index 42c7dfa78a..c0581b6814 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/PropsWithRef.scala +++ b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/PropsWithRef.scala @@ -9,7 +9,7 @@ import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, J * See https://www.typescriptlang.org/docs/handbook/2/conditional-types.html for an intro. * You'll have to cast your way around this structure, unfortunately. * TS definition: {{{ - 'ref' extends keyof P ? P extends react.anon.Ref ? string extends R ? react.react.PropsWithoutRef

& react.anon.0 : P : P : P + 'ref' extends keyof P ? P extends { ref :infer R | undefined} ? string extends R ? react.react.PropsWithoutRef

& { ref :std.Exclude | undefined} : P : P : P }}} */ @js.native diff --git a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/ReactManagedAttributes.scala b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/ReactManagedAttributes.scala index b1bb6dceca..584ee9030f 100644 --- a/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/ReactManagedAttributes.scala +++ b/tests/react-integration-test/check-japgolly-3/r/react/src/main/scala/typingsJapgolly/react/mod/ReactManagedAttributes.scala @@ -8,7 +8,7 @@ import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, J * See https://www.typescriptlang.org/docs/handbook/2/conditional-types.html for an intro. * You'll have to cast your way around this structure, unfortunately. * TS definition: {{{ - C extends react.anon.DefaultProps ? react.react.Defaultize * / any>, D> : C extends react.anon.PropTypes ? react.react.MergePropTypes * / any> : C extends react.anon.1 ? react.react.Defaultize : P + C extends { propTypes :infer T, defaultProps :infer D} ? react.react.Defaultize * / any>, D> : C extends { propTypes :infer T} ? react.react.MergePropTypes * / any> : C extends { defaultProps :infer D} ? react.react.Defaultize : P }}} */ @js.native diff --git a/tests/react-integration-test/check-japgolly-3/s/semantic-ui-react/build.sbt b/tests/react-integration-test/check-japgolly-3/s/semantic-ui-react/build.sbt index 4c56e402b3..3a9eb23f66 100644 --- a/tests/react-integration-test/check-japgolly-3/s/semantic-ui-react/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/s/semantic-ui-react/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "semantic-ui-react" -version := "0.0-unknown-68bc54" +version := "0.0-unknown-08f7ef" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt index 2119ff7254..d527168948 100644 --- a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-event-listener/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-event-listener" -version := "0.38.0-90ae78" +version := "0.38.0-45b64e" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt index 0281d28f59..f717aace6a 100644 --- a/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt +++ b/tests/react-integration-test/check-japgolly-3/s/stardust-ui__react-component-ref/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-ref" -version := "0.38.0-bb268d" +version := "0.38.0-151950" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.github.japgolly.scalajs-react" %%% "core" % "2.1.1", "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", - "org.scalablytyped" %%% "react" % "16.9.2-89c3ae", + "org.scalablytyped" %%% "react" % "16.9.2-f9dd03", "org.scalablytyped" %%% "std" % "0.0-unknown-f06d0f") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/c/componentstest/build.sbt b/tests/react-integration-test/check-slinky-3/c/componentstest/build.sbt index 346acd9241..cd4f7e79cb 100644 --- a/tests/react-integration-test/check-slinky-3/c/componentstest/build.sbt +++ b/tests/react-integration-test/check-slinky-3/c/componentstest/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "componentstest" -version := "0.0-unknown-b559f4" +version := "0.0-unknown-e063e5" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/r/react-bootstrap/build.sbt b/tests/react-integration-test/check-slinky-3/r/react-bootstrap/build.sbt index dfa7f0e199..5a81c50cd9 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-bootstrap/build.sbt +++ b/tests/react-integration-test/check-slinky-3/r/react-bootstrap/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-bootstrap" -version := "0.32-9191df" +version := "0.32-ae6c10" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/r/react-contextmenu/build.sbt b/tests/react-integration-test/check-slinky-3/r/react-contextmenu/build.sbt index 5a9e001015..7322886aa1 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-contextmenu/build.sbt +++ b/tests/react-integration-test/check-slinky-3/r/react-contextmenu/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-contextmenu" -version := "2.13.0-fb96e3" +version := "2.13.0-fed211" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt b/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt index 29bbd09a91..40ca35a4f6 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt +++ b/tests/react-integration-test/check-slinky-3/r/react-dropzone/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-dropzone" -version := "10.1.10-bdd78f" +version := "10.1.10-01ef01" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/r/react-markdown/build.sbt b/tests/react-integration-test/check-slinky-3/r/react-markdown/build.sbt index a0a03f0472..aef9ca9218 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-markdown/build.sbt +++ b/tests/react-integration-test/check-slinky-3/r/react-markdown/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-markdown" -version := "0.0-unknown-c5de7a" +version := "0.0-unknown-118adf" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/r/react-select/build.sbt b/tests/react-integration-test/check-slinky-3/r/react-select/build.sbt index 477979b37d..e315ae8c2a 100644 --- a/tests/react-integration-test/check-slinky-3/r/react-select/build.sbt +++ b/tests/react-integration-test/check-slinky-3/r/react-select/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "react-select" -version := "0.0-unknown-118bbf" +version := "0.0-unknown-cb7764" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/r/react/build.sbt b/tests/react-integration-test/check-slinky-3/r/react/build.sbt index 131f583a1d..09a5a6be8b 100644 --- a/tests/react-integration-test/check-slinky-3/r/react/build.sbt +++ b/tests/react-integration-test/check-slinky-3/r/react/build.sbt @@ -1,6 +1,6 @@ organization := "org.scalablytyped" name := "react" -version := "16.9.2-2aa5d1" +version := "16.9.2-cebe65" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( diff --git a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/anon.scala b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/anon.scala index 4843208a94..a37e44502d 100644 --- a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/anon.scala +++ b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/anon.scala @@ -1,51 +1,12 @@ package typingsSlinky.react import slinky.core.facade.ReactElement -import typingsSlinky.std.Exclude import org.scalablytyped.runtime.StObject import scala.scalajs.js import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess} object anon { - trait `0`[R] extends StObject { - - var ref: js.UndefOr[Exclude[R, String]] = js.undefined - } - object `0` { - - inline def apply[R](): `0`[R] = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[`0`[R]] - } - - extension [Self <: `0`[?], R](x: Self & `0`[R]) { - - inline def setRef(value: Exclude[R, String]): Self = StObject.set(x, "ref", value.asInstanceOf[js.Any]) - - inline def setRefUndefined: Self = StObject.set(x, "ref", js.undefined) - } - } - - trait `1` extends StObject { - - var defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any - } - object `1` { - - inline def apply( - defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any - ): `1` = { - val __obj = js.Dynamic.literal(defaultProps = defaultProps.asInstanceOf[js.Any]) - __obj.asInstanceOf[`1`] - } - - extension [Self <: `1`](x: Self) { - - inline def setDefaultProps(value: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any): Self = StObject.set(x, "defaultProps", value.asInstanceOf[js.Any]) - } - } - trait Children extends StObject { var children: js.UndefOr[ReactElement] = js.undefined @@ -65,30 +26,6 @@ object anon { } } - trait DefaultProps extends StObject { - - var defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any - - var propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any - } - object DefaultProps { - - inline def apply( - defaultProps: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any, - propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any - ): DefaultProps = { - val __obj = js.Dynamic.literal(defaultProps = defaultProps.asInstanceOf[js.Any], propTypes = propTypes.asInstanceOf[js.Any]) - __obj.asInstanceOf[DefaultProps] - } - - extension [Self <: DefaultProps](x: Self) { - - inline def setDefaultProps(value: /* import warning: importer.ImportType#apply Failed type conversion: infer D */ js.Any): Self = StObject.set(x, "defaultProps", value.asInstanceOf[js.Any]) - - inline def setPropTypes(value: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any): Self = StObject.set(x, "propTypes", value.asInstanceOf[js.Any]) - } - } - trait Html extends StObject { var __html: String @@ -105,42 +42,4 @@ object anon { inline def set__html(value: String): Self = StObject.set(x, "__html", value.asInstanceOf[js.Any]) } } - - trait PropTypes extends StObject { - - var propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any - } - object PropTypes { - - inline def apply(propTypes: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any): PropTypes = { - val __obj = js.Dynamic.literal(propTypes = propTypes.asInstanceOf[js.Any]) - __obj.asInstanceOf[PropTypes] - } - - extension [Self <: PropTypes](x: Self) { - - inline def setPropTypes(value: /* import warning: importer.ImportType#apply Failed type conversion: infer T */ js.Any): Self = StObject.set(x, "propTypes", value.asInstanceOf[js.Any]) - } - } - - trait Ref extends StObject { - - var ref: js.UndefOr[ - /* import warning: importer.ImportType#apply Failed type conversion: infer R */ js.Any - ] = js.undefined - } - object Ref { - - inline def apply(): Ref = { - val __obj = js.Dynamic.literal() - __obj.asInstanceOf[Ref] - } - - extension [Self <: Ref](x: Self) { - - inline def setRef(value: /* import warning: importer.ImportType#apply Failed type conversion: infer R */ js.Any): Self = StObject.set(x, "ref", value.asInstanceOf[js.Any]) - - inline def setRefUndefined: Self = StObject.set(x, "ref", js.undefined) - } - } } diff --git a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/FunctionComponentElement.scala b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/FunctionComponentElement.scala index a07846cc4a..d9911d0abb 100644 --- a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/FunctionComponentElement.scala +++ b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/FunctionComponentElement.scala @@ -9,7 +9,7 @@ trait FunctionComponentElement[P] with ReactElement { var ref: js.UndefOr[ - /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends react.anon.Ref ? R : never : never */ js.Any + /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends { ref :infer R | undefined} ? R : never : never */ js.Any ] = js.undefined } object FunctionComponentElement { @@ -23,7 +23,7 @@ object FunctionComponentElement { extension [Self <: FunctionComponentElement[?], P](x: Self & FunctionComponentElement[P]) { inline def setRef( - value: /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends react.anon.Ref ? R : never : never */ js.Any + value: /* import warning: importer.ImportType#apply Failed type conversion: 'ref' extends keyof P ? P extends { ref :infer R | undefined} ? R : never : never */ js.Any ): Self = StObject.set(x, "ref", value.asInstanceOf[js.Any]) inline def setRefUndefined: Self = StObject.set(x, "ref", js.undefined) diff --git a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/PropsWithRef.scala b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/PropsWithRef.scala index 526db90167..e976df05b3 100644 --- a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/PropsWithRef.scala +++ b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/PropsWithRef.scala @@ -9,7 +9,7 @@ import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, J * See https://www.typescriptlang.org/docs/handbook/2/conditional-types.html for an intro. * You'll have to cast your way around this structure, unfortunately. * TS definition: {{{ - 'ref' extends keyof P ? P extends react.anon.Ref ? string extends R ? react.react.PropsWithoutRef

& react.anon.0 : P : P : P + 'ref' extends keyof P ? P extends { ref :infer R | undefined} ? string extends R ? react.react.PropsWithoutRef

& { ref :std.Exclude | undefined} : P : P : P }}} */ @js.native diff --git a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/ReactManagedAttributes.scala b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/ReactManagedAttributes.scala index 7873ccf5c7..6cebf0e0a2 100644 --- a/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/ReactManagedAttributes.scala +++ b/tests/react-integration-test/check-slinky-3/r/react/src/main/scala/typingsSlinky/react/mod/ReactManagedAttributes.scala @@ -8,7 +8,7 @@ import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, J * See https://www.typescriptlang.org/docs/handbook/2/conditional-types.html for an intro. * You'll have to cast your way around this structure, unfortunately. * TS definition: {{{ - C extends react.anon.DefaultProps ? react.react.Defaultize * / any>, D> : C extends react.anon.PropTypes ? react.react.MergePropTypes * / any> : C extends react.anon.1 ? react.react.Defaultize : P + C extends { propTypes :infer T, defaultProps :infer D} ? react.react.Defaultize * / any>, D> : C extends { propTypes :infer T} ? react.react.MergePropTypes * / any> : C extends { defaultProps :infer D} ? react.react.Defaultize : P }}} */ @js.native diff --git a/tests/react-integration-test/check-slinky-3/s/semantic-ui-react/build.sbt b/tests/react-integration-test/check-slinky-3/s/semantic-ui-react/build.sbt index 1ed1fd2c2c..cb10f0dc61 100644 --- a/tests/react-integration-test/check-slinky-3/s/semantic-ui-react/build.sbt +++ b/tests/react-integration-test/check-slinky-3/s/semantic-ui-react/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "semantic-ui-react" -version := "0.0-unknown-87454a" +version := "0.0-unknown-490e19" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt index 5807928927..f50b2e61ca 100644 --- a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-event-listener/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-event-listener" -version := "0.38.0-b5d89a" +version := "0.38.0-1b2967" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt index 3a86e72c32..ae44f4286b 100644 --- a/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt +++ b/tests/react-integration-test/check-slinky-3/s/stardust-ui__react-component-ref/build.sbt @@ -1,12 +1,12 @@ organization := "org.scalablytyped" name := "stardust-ui__react-component-ref" -version := "0.38.0-171235" +version := "0.38.0-1fa9f7" scalaVersion := "3.1.2" enablePlugins(ScalaJSPlugin) libraryDependencies ++= Seq( "com.olvind" %%% "scalablytyped-runtime" % "2.4.2", "me.shadaj" %%% "slinky-web" % "0.7.2", - "org.scalablytyped" %%% "react" % "16.9.2-2aa5d1", + "org.scalablytyped" %%% "react" % "16.9.2-cebe65", "org.scalablytyped" %%% "std" % "0.0-unknown-8512d2") publishArtifact in packageDoc := false scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future") diff --git a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/transforms/ExtractInterfaces.scala b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/transforms/ExtractInterfaces.scala index 2e916c6aa7..a270fba931 100644 --- a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/transforms/ExtractInterfaces.scala +++ b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/transforms/ExtractInterfaces.scala @@ -55,8 +55,12 @@ object ExtractInterfaces { } } - def partOfTypeMapping(stack: List[TsTree], obj: TsTypeObject): Boolean = - stack.exists(_.isInstanceOf[TsMemberTypeMapped]) || TsType.isTypeMapping(obj.members) + def willBeErased(stack: List[TsTree], obj: TsTypeObject): Boolean = + stack.exists { + case _: TsMemberTypeMapped => true + case _: TsTypePredicate => true + case _ => false + } || TsType.isTypeMapping(obj.members) def isDictionary(members: IArray[TsMember]): Boolean = members.nonEmpty && members.forall { @@ -70,7 +74,7 @@ object ExtractInterfaces { case obj: TsTypeObject if obj.members.nonEmpty && !isDictionary(obj.members) && - !partOfTypeMapping(scope.stack, obj) && + !willBeErased(scope.stack, obj) && shouldBeExtracted(scope) => val referencedTparams: IArray[TsTypeParam] = TypeParamsReferencedInTree(scope.tparams, obj)