Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test case to show issue with export default #602

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ trait ImporterTest extends AnyFunSuite with ImporterHarness with ParallelTestExe
test("pixi.js")(assertImportsOk("pixi.js", pedantic = false))
test("augment-module")(assertImportsOk("augment-module", pedantic = false))
test("typings-json")(assertImportsOk("typings-json", pedantic = true))
test("export-default")(assertImportsOk("export-default", pedantic = true))
test("export-as-namespace")(assertImportsOk("export-as-namespace", pedantic = true))
test("babylon")(assertImportsOk("babylon", pedantic = true))
test("bigint")(assertImportsOk("bigint", pedantic = true))
Expand Down
11 changes: 11 additions & 0 deletions tests/export-default/check-3/e/export-default/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
organization := "org.scalablytyped"
name := "export-default"
version := "0.0-unknown-d7a32e"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
"org.scalablytyped" %%% "foo" % "0.0-unknown-f52260")
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"))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.11.0")
15 changes: 15 additions & 0 deletions tests/export-default/check-3/e/export-default/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Scala.js typings for export-default




## Note
This library has been generated from typescript code from first party type definitions.

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.


Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package typings.exportDefault

import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

/* This can be used to `require` the library as a side effect.
If it is a global library this will make scalajs-bundler include it */
@JSImport("export-default", JSImport.Namespace)
@js.native
object exportDefaultRequire extends StObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package typings.exportDefault

import typings.foo.mod.default
import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

object mod {

@JSImport("export-default", "Foo")
@js.native
open class Foo () extends default
}
10 changes: 10 additions & 0 deletions tests/export-default/check-3/f/foo/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
organization := "org.scalablytyped"
name := "foo"
version := "0.0-unknown-f52260"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2")
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"))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.6
1 change: 1 addition & 0 deletions tests/export-default/check-3/f/foo/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.11.0")
15 changes: 15 additions & 0 deletions tests/export-default/check-3/f/foo/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Scala.js typings for foo




## Note
This library has been generated from typescript code from first party type definitions.

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.


Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package typings.foo

import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

/* This can be used to `require` the library as a side effect.
If it is a global library this will make scalajs-bundler include it */
@JSImport("foo", JSImport.Namespace)
@js.native
object fooRequire extends StObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package typings.foo

import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

object mod {

@JSImport("foo", JSImport.Default)
@js.native
open class default ()
extends StObject
with Foo

trait Foo extends StObject
}
1 change: 1 addition & 0 deletions tests/export-default/in/export-default/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as Foo } from "foo";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this find foo?

1 change: 1 addition & 0 deletions tests/export-default/in/foo/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default class Foo {}
10 changes: 10 additions & 0 deletions tests/pixi-utils-7.4.0/check-3/e/eventemitter3/build.sbt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to commit these? I'd probably keep a subset of the the real code for pixi-utils rather than creating a ficticious export-default package.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
organization := "org.scalablytyped"
name := "eventemitter3"
version := "0.0-unknown-f8988b"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2")
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"))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.11.0")
15 changes: 15 additions & 0 deletions tests/pixi-utils-7.4.0/check-3/e/eventemitter3/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Scala.js typings for eventemitter3




## Note
This library has been generated from typescript code from first party type definitions.

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.


Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package typings.eventemitter3

import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

/* This can be used to `require` the library as a side effect.
If it is a global library this will make scalajs-bundler include it */
@JSImport("eventemitter3", JSImport.Namespace)
@js.native
object eventemitter3Require extends StObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package typings.eventemitter3

import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

object mod {

@JSImport("eventemitter3", JSImport.Namespace)
@js.native
open class ^[EventTypes, Context /* <: Any */] ()
extends StObject
with EventEmitter[EventTypes, Context]

trait EventEmitter[EventTypes, Context /* <: Any */] extends StObject
}
11 changes: 11 additions & 0 deletions tests/pixi-utils-7.4.0/check-3/p/pixi__utils/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
organization := "org.scalablytyped"
name := "pixi__utils"
version := "0.0-unknown-02740c"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
"org.scalablytyped" %%% "eventemitter3" % "0.0-unknown-f8988b")
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"))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.6
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.11.0")
15 changes: 15 additions & 0 deletions tests/pixi-utils-7.4.0/check-3/p/pixi__utils/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Scala.js typings for pixi__utils




## Note
This library has been generated from typescript code from first party type definitions.

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.


Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package typings.pixiUtils

import typings.eventemitter3.mod.^
import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

object libMod {

@JSImport("@pixi/utils/lib", "EventEmitter")
@js.native
open class EventEmitter[EventTypes, Context /* <: Any */] () extends ^[EventTypes, Context]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package typings.pixiUtils

import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

/* This can be used to `require` the library as a side effect.
If it is a global library this will make scalajs-bundler include it */
@JSImport("@pixi/utils", JSImport.Namespace)
@js.native
object pixiUtilsRequire extends StObject