Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from jonas/test-and-import-improvements
Test and import improvements
- Loading branch information
Showing
18 changed files
with
271 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
scalaVersion := "2.12.3" | ||
inThisBuild(Def.settings( | ||
organization := "org.scalajs.tools", | ||
version := "0.1-SNAPSHOT", | ||
scalaVersion := "2.12.3", | ||
scalacOptions ++= Seq( | ||
"-deprecation", | ||
"-unchecked", | ||
"-feature", | ||
"-encoding", "utf8" | ||
) | ||
)) | ||
|
||
name := "TypeScript importer for Scala.js" | ||
val `scala-js-ts-importer` = project.in(file(".")) | ||
.settings( | ||
description := "TypeScript importer for Scala.js", | ||
mainClass := Some("org.scalajs.tools.tsimporter.Main"), | ||
libraryDependencies ++= Seq( | ||
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.6", | ||
"org.scalatest" %% "scalatest" % "3.0.4" % Test | ||
) | ||
) | ||
|
||
version := "0.1-SNAPSHOT" | ||
|
||
mainClass := Some("org.scalajs.tools.tsimporter.Main") | ||
|
||
libraryDependencies ++= Seq( | ||
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.6", | ||
"org.scalatest" %% "scalatest" % "3.0.4" % Test | ||
) | ||
|
||
organization := "org.scalajs.tools" | ||
|
||
scalacOptions ++= Seq( | ||
"-deprecation", | ||
"-unchecked", | ||
"-feature", | ||
"-encoding", "utf8" | ||
) | ||
|
||
fork in Test := true | ||
val samples = project | ||
.enablePlugins(ScalaJSPlugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=0.13.9 | ||
sbt.version=1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.20") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export class Point { | ||
constructor(x: number, y: number); | ||
readonly x: number; | ||
readonly y: number; | ||
static isPoint(thing: any): boolean; | ||
} | ||
|
||
declare module nested { | ||
type Line = Array<Point>; | ||
|
||
export class Circle { | ||
constructor(center: Point, radius: number); | ||
readonly center: Point; | ||
readonly radius: number; | ||
static isCirce(thing: any): boolean; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
import scala.scalajs.js | ||
import js.annotation._ | ||
import js.| | ||
|
||
package importedjs { | ||
|
||
@js.native | ||
@JSGlobal | ||
class Point protected () extends js.Object { | ||
def this(x: Double, y: Double) = this() | ||
def x: Double = js.native | ||
def y: Double = js.native | ||
} | ||
|
||
@js.native | ||
@JSGlobal | ||
object Point extends js.Object { | ||
def isPoint(thing: js.Any): Boolean = js.native | ||
} | ||
|
||
package nested { | ||
|
||
@js.native | ||
@JSGlobal("nested.Circle") | ||
class Circle protected () extends js.Object { | ||
def this(center: Point, radius: Double) = this() | ||
def center: Point = js.native | ||
def radius: Double = js.native | ||
} | ||
|
||
@js.native | ||
@JSGlobal("nested.Circle") | ||
object Circle extends js.Object { | ||
def isCirce(thing: js.Any): Boolean = js.native | ||
} | ||
|
||
@js.native | ||
@JSGlobal("nested") | ||
object Nested extends js.Object { | ||
type Line = js.Array[Point] | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
declare module overrides { | ||
|
||
export class A { | ||
equals(other: A): boolean; | ||
clone(): A; | ||
toString(): string; | ||
} | ||
|
||
interface BLike { | ||
toString(): string; | ||
} | ||
|
||
export class B extends BLike { | ||
equals(other: any): boolean; | ||
clone(): BLike; | ||
toString(): string; | ||
} | ||
|
||
interface C { | ||
equals(other: any): boolean; | ||
clone(): C; | ||
toString(): string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
import scala.scalajs.js | ||
import js.annotation._ | ||
import js.| | ||
|
||
package importedjs { | ||
|
||
package overrides { | ||
|
||
@js.native | ||
@JSGlobal("overrides.A") | ||
class A extends js.Object { | ||
def equals(other: A): Boolean = js.native | ||
override def clone(): A = js.native | ||
override def toString(): String = js.native | ||
} | ||
|
||
@js.native | ||
trait BLike extends js.Object { | ||
override def toString(): String = js.native | ||
} | ||
|
||
@js.native | ||
@JSGlobal("overrides.B") | ||
class B extends BLike { | ||
def equals(other: js.Any): Boolean = js.native | ||
override def clone(): BLike = js.native | ||
override def toString(): String = js.native | ||
} | ||
|
||
@js.native | ||
trait C extends js.Object { | ||
def equals(other: js.Any): Boolean = js.native | ||
override def clone(): C = js.native | ||
override def toString(): String = js.native | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
declare module stringlit { | ||
|
||
export type BuiltinTheme = 'vs' | 'vs-dark' | 'hc-black'; | ||
|
||
export interface IEditorOptions { | ||
ariaLabel?: string; | ||
rulers?: number[]; | ||
selectionClipboard?: boolean; | ||
lineNumbers?: 'on' | 'off' | 'relative' | ((lineNumber: number) => string); | ||
readable?: 'yes' | boolean | 'restricted'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
import scala.scalajs.js | ||
import js.annotation._ | ||
import js.| | ||
|
||
package importedjs { | ||
|
||
package stringlit { | ||
|
||
@js.native | ||
trait IEditorOptions extends js.Object { | ||
var ariaLabel: String = js.native | ||
var rulers: js.Array[Double] = js.native | ||
var selectionClipboard: Boolean = js.native | ||
var lineNumbers: String | js.Function1[Double, String] = js.native | ||
var readable: String | Boolean = js.native | ||
} | ||
|
||
@js.native | ||
@JSGlobal("stringlit") | ||
object Stringlit extends js.Object { | ||
type BuiltinTheme = String | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
declare module then { | ||
|
||
interface Thenable<T> { | ||
then<TResult>( | ||
onfulfilled?: (value: T) => TResult | Thenable<TResult>, | ||
onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>; | ||
} | ||
|
||
class then {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
import scala.scalajs.js | ||
import js.annotation._ | ||
import js.| | ||
|
||
package importedjs { | ||
|
||
package `then` { | ||
|
||
@js.native | ||
trait Thenable[T] extends js.Object { | ||
def `then`[TResult](onfulfilled: js.Function1[T, TResult | Thenable[TResult]] = ???, onrejected: js.Function1[js.Any, TResult | Thenable[TResult]] = ???): Thenable[TResult] = js.native | ||
} | ||
|
||
@js.native | ||
@JSGlobal("then.then") | ||
class `then` extends js.Object { | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.