Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 09:44

    oyvindberg on v1.0.0-beta38

    (compare)

  • Jun 19 09:44

    oyvindberg on gh-pages

    Deploy website Deploy website … (compare)

  • Jun 19 08:04

    oyvindberg on master

    release: bump scalajs and sbt i… make TypeParamsReferencedInTree… Make props unpacking from #444 … (compare)

  • Jun 03 19:42

    oyvindberg on master

    scalafmt (compare)

  • Jun 02 22:24

    oyvindberg on master

    support new NotNeededPackages.j… create cache folder on boot add --legacy-peer-deps (compare)

  • Jun 02 21:22

    oyvindberg on master

    fix assembly. meh all of this (compare)

  • Jun 02 11:26

    oyvindberg on master

    fix assembly. meh all of this (compare)

  • May 29 19:42

    oyvindberg on master

    Update sbt-sonatype to 3.9.13 (… (compare)

  • May 24 20:22

    oyvindberg on master

    Adjust `withRef` to take a java… (compare)

  • May 24 07:44

    oyvindberg on master

    Bloop 1.5.0, Scala 3.1.2/2.13.8… Slinky 0.7.2, Scalajs-react 2.1… Fix #431 by ignoring files and 5 more (compare)

  • May 24 00:38

    oyvindberg on master

    fix test (compare)

  • May 24 00:15

    oyvindberg on master

    Fix instructions in import-prob… (compare)

  • May 24 00:12

    oyvindberg on master

    "as" clauses in mapped types ca… TypeParamsReferencedInTree is n… Allow repeated types in tuples … (compare)

  • May 23 23:30

    oyvindberg on master

    Slinky 0.7.2, Scalajs-react 2.1… Fix #431 by ignoring files Fix #444 by handling `ForwardRe… (compare)

  • May 23 21:42

    oyvindberg on master

    Bloop 1.5.0, Scala 3.1.2/2.13.8… (compare)

  • May 23 21:32

    oyvindberg on master

    Update scalatest to 3.2.12 (#44… (compare)

  • May 23 21:18

    oyvindberg on master

    Fix #438: Instantiable23 type n… (compare)

  • May 23 21:17

    oyvindberg on master

    Update fansi to 0.3.1 (#414) (compare)

  • May 23 21:10

    oyvindberg on fansi-0.3.1

    Update fansi to 0.3.1 (compare)

  • May 23 21:10

    oyvindberg on master

    Update sbt-tpolecat to 0.3.1 (#… (compare)

Øyvind Raddum Berg
@oyvindberg
@sjrd i suppose that works. I've used yarn instead because it returns ~instantly if everything is installed
Sébastien Doeraene
@sjrd
Ah I see. That might be a good reason to use yarn.
Jamal CHAQOURI
@redarqas_gitlab
Hey, I'm trying to convert a lib that I want to run using node and not the browser. This lib declares a browserify dependency: https://www.npmjs.com/package/buffer. I want the conversion to exclude this browserify dependency and use node buffer types instead, is that possible ?
Thank you for your help
Jamal CHAQOURI
@redarqas_gitlab
Also i find myself with the same type declared multiple time: typings.std.Uint8Array typings.std.global.Uint8Array (extends previous) but also scala.scalajs.js.typedarray.Uint8Array , is there a way to stick with just the last one ? sorry if it seems obvious
Simon Parten
@Quafadas
I'm having a go with the mill scalably typed plugin, and getting this;
[error] 2022-05-19T18:54:30.269491Z Phase3Compile.scala:147 err Compiling std (1807 Scala sources)
Compiled std (2999ms)
[E] Unexpected error when compiling std: 'class dotty.tools.dotc.core.Symbols$NoSymbol$ cannot be cast to class dotty.tools.dotc.core.Symbols$ClassSymbol (dotty.tools.dotc.core.Symbols$NoSymbol$ and dotty.tools.dotc.core.Symbols$ClassSymbol are in unnamed module of loader java.net.URLClassLoader @4451e4fe)'
[E] Failed to compile 'std'
 [id => std, thread => 250, phase => build, flavour => NormalFlavour]
[warn ] 2022-05-19T18:54:30.275106Z ScalablyTypedWorkerImpl.scala:269 td 15656 
Failure: You might try to set:
  def scalablyTypedIgnoredLibs = Seq("std")
std: Compilation failed: Compiled std (2999ms) (/Users/simon/Code/mill-full-stack/mill-full-stack/node_modules/typescript/lib)
1 targets failed
stModule.scalablyTypedImportTask java.lang.Exception
    com.github.lolgab.mill.scalablytyped.worker.ScalablyTypedWorkerImpl.scalablytypedImport(ScalablyTypedWorkerImpl.scala:296)
    com.github.lolgab.mill.scalablytyped.ScalablyTyped.$anonfun$scalablyTypedImportTask$2(ScalablyTyped.scala:56)
    mill.define.Task$TraverseCtx.evaluate(Task.scala:380)
I'm not familiar enough with any of the projects, to have a real hint on what this is telling me. Is this likely to be misconfiguration? I'm was trying with scala 3.1.2 adn scalajs 3.10.0?
Simon Parten
@Quafadas

Aha, if I set scalaVersion = "3.1.0" then it appears to work well.

I am happy with that - thankyou for this wonderful tool

Lorenzo Gabriele
@lolgab
@Quafadas What version were you using before? The error message should be improved because you can't ignore "std"
Simon Parten
@Quafadas
3.1.2 ...
Lorenzo Gabriele
@lolgab
Interesting. I was facing the same problem the other day. Don't know if it is a Scalablytyped or a mill-scalablytyped error.
But for sure I will change the error message to not tell you to ignore "std" since you can't and you shouldn't.
Øyvind Raddum Berg
@oyvindberg
I'm seeing the same issue outside of mill-scalablytyped. I guess we'll need a new bloop to compile scala 3.1.2
@redarqas_gitlab It's a bit complicated. You're importing a library (std) which contains that type, so it's translated. However, ~all references to that type will be rewritten to scala.scalajs.js.typedarray.Uint8Array, given that https://scalablytyped.org/docs/conversion-options#stusescalajsdom is set to true (it is by default). The few cases where you'll see usage of the other types would be in inheritance clauses, as that is a much more complicated rewrite
Also note that you can safely cast between these types. It's ok to be a bit more liberal with casts when interfacing with javascript
@velvetbaldmime:matrix.org sorry about late answer. it's not the same issue, even though both issues involve the word as :)
Øyvind Raddum Berg
@oyvindberg
The thing you came across is (relatively) recent addition to typescript, where it renames members in an object type with a mapped type, typically it's used together with template strings. This is rather type austronauty and I haven't gotten around to implementing it yet. An easyish thing to do would be to extend the parser to recognize that as token, and then ignore it with a warning
1 reply
Jamal CHAQOURI
@redarqas_gitlab
Thank you @oyvindberg for the explanation. Casting between these types is what I ended up by doing
elkhadirzyad
@elkhadirzyad

hello @oyvindberg , i wanted to test mui 5 components, i tried to add this block of code to build.sbt

lazy val demo =
  project
    .in(file("demo")).dependsOn( muiScalaJsReact)
    .enablePlugins(ScalaJSBundlerPlugin)
    .settings(
      webpackDevServerPort := 8080,

      scalaJSUseMainModuleInitializer := true,
      webpackBundlingMode := BundlingMode.LibraryOnly(),
      webpackDevServerExtraArgs := Seq("--inline"),
      webpackConfigFile in fastOptJS := Some(
        baseDirectory.value / "dev.webpack.config.js"
      ),
      version in webpack := "4.30.0",
      version in webpackCliVersion := "3.3.2",
      version in startWebpackDevServer := "3.3.1",


      // don't publish the demo
      publish := {},
      publishLocal := {},
      publishArtifact := false,
      Keys.`package` := file(""),
      npmDevDependencies in Compile ++= Seq(
        "css-loader" -> "3.4.2",
        "style-loader" -> "1.1.3"
      )
    )

but when i run startDemo i got the error :

[error] stack trace is suppressed; run last demo / update for the full output
[error] (demo / update) sbt.librarymanagement.ResolveException: Error downloading com.olvind.st-material-ui:st-material-ui-scalajs-react_sjs1_2.12:0.1
[error]   Not found
[error]   Not found
[error]   not found: /home/asaunix/.ivy2/local/com.olvind.st-material-ui/st-material-ui-scalajs-react_sjs1_2.12/0.1/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/com/olvind/st-material-ui/st-material-ui-scalajs-react_sjs1_2.12/0.1/st-material-ui-scalajs-react_sjs1_2.12-0.1.pom
[error] Total time: 2 s, completed 1 juin 2022 15:42:36
Alexis Hernandez
@AlexITC
the module might not be published and you may need to run sbt publishLocal
elkhadirzyad
@elkhadirzyad
thanks @AlexITC , i found the pb, i should add scalaVersion= "2.13.7" in .settings()
elkhadirzyad
@elkhadirzyad
hello @oyvindberg sorry for disturbing , after publishing the mui5 library, i tried 2 call it in ScalaJsReactDemos-master, here is the build.sbt,
  lazy val `material-ui-v5` =
  project
    .enablePlugins(ScalablyTypedConverterPlugin)
    .configure(baseSettings, browserProject, reactNpmDeps, withCssLoading, bundlerSettings)
    .settings(
      useYarn := true,
      webpackDevServerPort := 8018,
      stFlavour := Flavour.ScalajsReact,
      stReactEnableTreeShaking := Selection.All,
      Compile / npmDependencies ++= Seq(
     "@emotion/react" -> "11.7.1",
      //  "@emotion/styled" -> "11.6.0",
        "@mui/material" -> "5.2.6",
        "@mui/icons-material" -> "5.2.5",
        "@types/react" -> "17.0.38",
        "@types/react-dom" -> "17.0.11",
        "@types/stylis" -> "4.0.2",
        "react" -> "17.0.2",
        "react-dom" -> "17.0.2",
      ),
      libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core"           % "2.0.0",
      libraryDependencies += "com.github.japgolly.scalajs-react" %%% "extra"          % "2.0.0",
      libraryDependencies += "com.olvind.st-material-ui" %%% "st-material-ui-scalajs-react"          % "0.1",
    )
but i got the error
[error] ImportTree.scala:394 message Unsupported index type TypeRef(QualifiedName(IArray(Name(<union>))),IArray(TypeRef(QualifiedName(IArray(Name(java), Name(lang), Name(String))),IArray(),NoComments), TypeRef(QualifiedName(IArray(Name(scala), Name(Double))),IArray(),NoComments)),NoComments) [thread => 259, project => material-ui-v5, ms => 89028, phase => scala.js, scope => TreeScope(TsParsedFile() / TsDeclModule(@mui/system/cssVars/cssVarsParser) / TsDeclInterface(NestedRecord) / TsMemberIndex()), id => @mui/system]com.olvind.logging.Logger$LoggedException: Unsupported index type TypeRef(QualifiedName(IArray(Name(<union>))),IArray(TypeRef(QualifiedName(IArray(Name(java), Name(lang), Name(String))),IArray(),NoComments), TypeRef(QualifiedName(IArray(Name(scala), Name(Double))),IArray(),NoComments)),NoComments)
[error]     at com.olvind.logging.Logger$LoggingOps$.fatal$extension(Logger.scala:178)
[error]     at org.scalablytyped.converter.internal.importer.ImportTree.tsMember(ImportTree.scala:394)
[error]     at org.scalablytyped.converter.internal.importer.ImportTree.$anonfun$decl$5(ImportTree.scala:235)
[error]     at org.scalablytyped.converter.internal.IArray.map(IArray.scala:491)
[error]     at org.scalablytyped.converter.internal.importer.ImportTree.decl(ImportTree.scala:235)
[error]     at org.scalablytyped.converter.internal.importer.ImportTree.$anonfun$container$1(ImportTree.scala:617)
[error]     at org.scalablytyped.converter.internal.IArray.map(IArray.scala:491)
[error]     at org.scalablytyped.converter.internal.importer.ImportTree.container(ImportTree.scala:617)
Øyvind Raddum Berg
@oyvindberg
@elkhadirzyad you already have generated code locally published. Remove enablePlugins(ScalablyTypedConverterPlugin) and st keys
elkhadirzyad
@elkhadirzyad
thanks @oyvindberg , when i comment .enablePlugins(Scala..) i got the error :
[error] References to undefined settings: 
[error] 
[error]   material-ui-v5 / Compile / npmDevDependencies from material-ui-v5 / Compile / npmDevDependencies (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:83)
[error] 
[error]   material-ui-v5 / Compile / fastOptJS / startWebpackDevServer from material-ui-v5 / start (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:98)
[error] 
[error]   material-ui-v5 / Compile / npmDependencies from material-ui-v5 / Compile / npmDependencies (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:61)
[error] 
[error]   material-ui-v5 / Compile / fullOptJS / webpack from material-ui-v5 / dist (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:101)
[error] 
[error]   material-ui-v5 / Compile / fastOptJS / webpackExtraArgs from material-ui-v5 / Compile / fastOptJS / webpackExtraArgs (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:73)
[error] 
[error]   material-ui-v5 / Compile / fullOptJS / webpackDevServerExtraArgs from material-ui-v5 / Compile / fullOptJS / webpackDevServerExtraArgs (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:76)
[error] 
[error]   material-ui-v5 / Compile / fullOptJS / webpackExtraArgs from material-ui-v5 / Compile / fullOptJS / webpackExtraArgs (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:74)
[error] 
[error]   material-ui-v5 / Compile / fastOptJS / webpackDevServerExtraArgs from material-ui-v5 / Compile / fastOptJS / webpackDevServerExtraArgs (/home/asaunix/workspace/ScalaJsReactDemos-master/build.sbt:75)
[error]  
[error] Use 'last' for the full log.
Øyvind Raddum Berg
@oyvindberg
You'll need scalajs and scalajs bundler plugins instead
elkhadirzyad
@elkhadirzyad
thnaks @oyvindberg , even with .enablePlugins(ScalaJSPlugin) it gives the same error, i share the build.sbt :
lazy val `material-ui-v5` =
  project
    .enablePlugins(ScalaJSPlugin)
    // .enablePlugins(ScalablyTypedConverterPlugin)
    .configure(baseSettings, browserProject, reactNpmDeps, withCssLoading, bundlerSettings)
    .settings(
      /*  scalaVersion := "2.13.7",
              scalaJSUseMainModuleInitializer := true,*/
      useYarn := true,
      webpackDevServerPort := 8018,
      stFlavour := Flavour.ScalajsReact,
      stReactEnableTreeShaking := Selection.All,
      libraryDependencies += "com.github.japgolly.scalajs-react" %%% "core" % "2.0.0",
      libraryDependencies += "com.github.japgolly.scalajs-react" %%% "extra" % "2.0.0",
      libraryDependencies += "com.olvind.st-material-ui" %%% "st-material-ui-scalajs-react" % "0.1"
    )
Øyvind Raddum Berg
@oyvindberg
Read last message again
elkhadirzyad
@elkhadirzyad
@oyvindberg , it's working many thanks ;)
elkhadirzyad
@elkhadirzyad
hello @oyvindberg , in the previous version of mui with scalablytyped plugin in order to use useState , i worked with import typings.react.mod.useState. with the new version of mui, i can not use import typings.react.mod.useState since the scalablytyped plugin is disabled.
Øyvind Raddum Berg
@oyvindberg
I suppose you can change the line in the mui5 build with stMinimize and add react to that list. Then publish locally again
elkhadirzyad
@elkhadirzyad
thnks @oyvindberg , ill do that
elkhadirzyad
@elkhadirzyad
@oyvindberg , i have this line stMinimize := Selection.AllExcept("@mui/material", "@mui/icons-material", "@mui/react") in build.sbt in mui5 project. After publication, i have mui/react but there no useState() anywhere
Øyvind Raddum Berg
@oyvindberg
because you're not using useState from a library called @mui/react
elkhadirzyad
@elkhadirzyad
Ok, so i should use react with a specific version ? Not "@mui/react". In the mui5 project there is no useState() function.
elkhadirzyad
@elkhadirzyad
with import japgolly.scalajs.react.facade.React.useState i got the error
 type mismatch;
[error]  found   : Boolean(false)
[error]  required: ? | scala.scalajs.js.Function0[?]
[error]     val js.Tuple2(loading, setLoading) = useState(false)
[error]
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

The error is reproducible with package.json:

{
  "private": true,
  "license": "UNLICENSED",
  "dependencies": {
    "type-fest": "2.13.1",
    "typescript": "4.3"
  }
}

then npm install and then cs launch stc

I will try ignoring this library in the build and see if everything still works.
Also will be happy to contribute a fix (bandaid), when I understand how to make it break in the first place :)

Øyvind Raddum Berg
@oyvindberg
Is it possible this fixed it ScalablyTyped/Converter@a2bdf6c ? It's in master but not released yet
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
ahhhhh. Right. Let me checkout the tag I'm using

There we go!

Awesome, I won't create an issue then. Great work!

(that's beta37)
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
Ignoring the lib in the plugin worked and I was able to build a desktop app with Tauri :)
Love ST.
Øyvind Raddum Berg
@oyvindberg
Always happy to hear that it works for things I've never heard of. Consider contributing a demo of it if seems useful for more people :)
elkhadirzyad
@elkhadirzyad

hello @oyvindberg , i hope ur ok, i'm finding difficulties in using the component Tabs in mui 5, i tried this without success

Tabs(activeTabId)
      .withKey(key)
     .className("className")
      .indicatorColor(indicatorColor)
      .textColor(textColor)
      .centered(centered)
      .onChange(onChange)

here is Tabs class :

object Tabs {

  def apply(
    p: /* props */ (DefaultComponentProps[
      TabsTypeMap[
        js.Object, 
        js.Function1[
          /* props */ OverridePropsExtendButtonBaseTypeMapButtAbout | DefaultComponentPropsExtendButtonBaseTypAction, 
          Element | Null
        ]
      ]
    ]) with `26`
  ): Default[js.Object] = new Default[js.Object](js.Array(this.component, p.asInstanceOf[js.Any]))

  @JSImport("@mui/material", "Tabs")
  @js.native
  val component: js.Object = js.native

  implicit def make(companion: Tabs.type): Default[js.Object] = new Default[js.Object](js.Array(this.component, js.Dictionary.empty))()
}
Oh, tabs plural, right
Yeah that's broken
How about the rest though? Any success?
elkhadirzyad
@elkhadirzyad
@oyvindberg , yes Tabs in plural, is there a way to make it work ? for the others i'm still testing