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

Add useScalaJsDomTypes to worker API #32

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Defaults to the project root directory (the directory of `build.sc`).

The typescript dependencies to ignore during the conversion

### useScalaJsDomTypes

When true (which is the default) uses scala-js-dom types when possible instead of types we translate from typescript in std

### scalablyTypedFlavour

The React flavour used by ScalablyTyped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

public interface ScalablyTypedWorkerApi {
ScalablyTypedWorkerDep[] scalablytypedImport(Path basePath, Path ivyHomePath, Path targetPath, String scalaVersion,
String scalaJSVersion, String[] ignoredLibs, ScalablyTypedWorkerFlavour flavour);
String scalaJSVersion, String[] ignoredLibs, boolean useScalaJsDomTypes, ScalablyTypedWorkerFlavour flavour);
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ class ScalablyTypedWorkerImpl extends ScalablyTypedWorkerApi {
scalaVersion: String,
scalaJSVersion: String,
ignoredLibs: Array[String],
useScalaJsDomTypes: Boolean,
flavour: ScalablyTypedWorkerFlavour
): Array[ScalablyTypedWorkerDep] = {

val DefaultOptions = ConversionOptions(
useScalaJsDomTypes = true,
useScalaJsDomTypes = useScalaJsDomTypes,
outputPackage = Name.typings,
enableScalaJsDefined = Selection.All,
flavour = toScalablyTyped(flavour),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ trait ScalablyTyped extends ScalaJSModule with VersionSpecific {
*/
def scalablyTypedIgnoredLibs: T[Seq[String]] = T { Seq.empty[String] }

/** When true (which is the default) uses scala-js-dom types when possible instead of types we translate from typescript in std
*/
def useScalaJsDomTypes: T[Boolean] = T { true }

/** ScalablyTyped flavours so far enables rich interop with react.
*/
def scalablyTypedFlavour: T[Flavour] = T {
Expand Down Expand Up @@ -52,6 +56,7 @@ trait ScalablyTyped extends ScalaJSModule with VersionSpecific {
scalaVersion(),
scalaJSVersion(),
scalablyTypedIgnoredLibs().toArray,
useScalaJsDomTypes(),
flavour
)
deps.map { dep =>
Expand Down
Loading