Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 14 15:39

    oyvindberg on v1.0.0-beta41

    (compare)

  • Jan 14 15:39

    oyvindberg on gh-pages

    Deploy website Deploy website … (compare)

  • Jan 10 22:39

    oyvindberg on master

    Update coursier to 2.1.0-RC4 (#… (compare)

  • Jan 10 22:39

    oyvindberg on master

    Update scalatest to 3.2.15 (#51… (compare)

  • Jan 10 22:38

    oyvindberg on master

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

  • Jan 10 22:38

    oyvindberg on master

    release snapshots disable extension methods - in… ImportTypingsGenSources: Add `o… (compare)

  • Dec 25 2022 22:55

    oyvindberg on mui5-support

    ImportTypingsGenSources: Add `o… (compare)

  • Dec 19 2022 20:18

    oyvindberg on mui5-support

    tree shaking: mui forbids diggi… (compare)

  • Dec 19 2022 19:24

    oyvindberg on master

    Update sbt-assembly to 2.1.0 (#… (compare)

  • Dec 19 2022 19:24

    oyvindberg on master

    Update coursier to 2.1.0-RC3-1 … (compare)

  • Dec 19 2022 19:24

    oyvindberg on master

    Update sbt-bloop to 1.5.6 (#507) (compare)

  • Dec 18 2022 00:09

    oyvindberg on mui5-support

    ignore `OverridableStringUnion`… (compare)

  • Dec 17 2022 12:54

    oyvindberg on mui5-support

    improve component variant naming (compare)

  • Dec 17 2022 02:03

    oyvindberg on mui5-support

    trim code release snapshots (compare)

  • Dec 17 2022 01:06

    oyvindberg on master

    scalajs-react: don't overload `… (compare)

  • Dec 17 2022 00:32

    oyvindberg on master

    Avoid superfluous `T & Object` react: add a `Props` type alias scalajs-react: add syntax to ap… and 3 more (compare)

  • Dec 14 2022 19:29

    oyvindberg on mui5-support

    limit mangled objects to 5k mem… mapped indices in type mappings… remove a source of irritating t… and 4 more (compare)

  • Nov 17 2022 09:50

    oyvindberg on master

    Update sbt-scalafmt to 2.5.0 (#… (compare)

  • Nov 17 2022 09:49

    oyvindberg on master

    Update coursier to 2.1.0-RC2 (#… (compare)

  • Nov 16 2022 20:53

    oyvindberg on true-literal-and-union-types

    True literal types and union ty… (compare)

Øyvind Raddum Berg
@oyvindberg
Also i dont know if you did that, but i have always started with some typescript example and translated. That way it's fairly mechanical
mn98
@mn98
@oyvindberg, thanks for the pointers! I agree the Slinky part is a distraction (but working) and I will move the demo.
I also thought copying a typescript example would be straightforward, but I've been stumped by the "encoding" part (which is commented out in the code I checked in).
image.png
mn98
@mn98
It's now mechanically operational, but I can't figure out how to create instances of some of the required types, e.g. Test with NumericValueRef.
Øyvind Raddum Berg
@oyvindberg
All ST types have a combineWith method which helps you construct intersection types
Lorenzo Gabriele
@lolgab
Hello :)
Released mill-scalablytyped 0.0.7 which bumps Scalablytyped to 1.0.0-beta39
Anton Sviridov
@velvetbaldmime:matrix.org
[m]
It's notably missing from ScalablyTyped.org :)
3 replies
Simon Parten
@Quafadas

@mn98 I hope your experiments are going well. A while back, I also wanted scala to do more with vega / lite. This is off topic - but after a while playing with them in scalably typed and learning, I went my own way and did something slightly different. I would note in general, it's worth knowing scalably typed, because it's amazing. In the very specific case of vega / lite, I ended up writing my own much more custom wrapper around it, leaning into it's JSON-ness, rather than it's typescript-ness.

https://quafadas.github.io/dedav4s/

If you do give it a go any feedback would be welcomed... but either way wishing you luck with whatever works!

mn98
@mn98
@Quafadas, I like to think I'm not incompetent but I'm really struggling to create even the simplest vega-lite VisualizationSpec, I'm still stumped on the "encoding" piece!
I'm using ScalablyTyped for a host of other libraries and it is indeed amazing and a largely painless experience.
Your alternative approach looks very interesting indeed, I shall certainly have a play around with that! After all, I'm just looking for a good charting experience with scala-js.
Øyvind Raddum Berg
@oyvindberg
@mn98 I had a closer look at vega-lite, and it's not a joy to use in its current state, unfortunately. The library is not too crazily modelled, but it does push the limits of the conversion and scala capabilities
For instance a lot of usage of Partial, so you end up with monstrosities like js.UndefOr[Partial[js.UndefOr[LatLongDef[F]]]]
For the concrete encoding thing you're missing, note that typings.vegaEmbed.mod.default takes a spec which can have one of many shapes. one of them is TopLevelLayerSpecField, which has an encoding member. maybe some of the other have that as well
so yeah. I'd try @Quafadas library :)
mn98
@mn98
@oyvindberg thanks for sharing your thoughts on this one, I might well let @Quafadas's library do the work for me here :-)
Simon Parten
@Quafadas
Out of curiosity, has anyone tried ST with this lib;
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser? Any public prior art :-)?
elkhadirzyad
@elkhadirzyad
Hello, is there a solution for the component Tabs in mui5 ;) ?
Krišjānis Veinbahs
@kshaa

Architecturally speaking. Should it possible to:
1) develop a Scala.JS React component which uses some NPM packages with types generated using ScalablyTyped
2) publish this component in a package repository (e.g. an Artifactory Maven repository) as a Scala.JS JAR
3) use this Scala.JS component in a project which doesn't integrate with or use the ScalablyTyped plugin

I executed step no. 1 and no. 2., but it seems that on step no. 3. i.e. when I'm attempting to build the project sbt seems to be trying to read ScalablyTyped definitions. E.g. my component uses Fuse.JS and even though it was compiled and published to a repo, the non-ScalablyTyped project is still trying to once again find and use ScalablyTyped definitions.

[2022-09-23T06:53:38.671Z] [error] Error downloading org.scalablytyped:fuse_dot_js_sjs1_2.13:6.6.2-5a0c84
[2022-09-23T06:53:38.671Z] [error]   Not found
[2022-09-23T06:53:38.671Z] [error]   Not found
[2022-09-23T06:53:38.671Z] [error]   not found: /home/<BUILD_USER>/.ivy2/local/org.scalablytyped/fuse_dot_js_sjs1_2.13/6.6.2-5a0c84/ivys/ivy.xml
[2022-09-23T06:53:38.671Z] [error]   not found: https://<PRIVATE_REPO_1>/org/scalablytyped/fuse_dot_js_sjs1_2.13/6.6.2-5a0c84/fuse_dot_js_sjs1_2.13-6.6.2-5a0c84.pom
[2022-09-23T06:53:38.671Z] [error]   not found: https://<PRIVATE_REPO_2>/org.scalablytyped/fuse_dot_js_sjs1_2.13/6.6.2-5a0c84/ivys/ivy.xml

TL;DR - Is it possible to somehow export a ScalablyTyped Scala.JS package and have it be standalone i.e. independant of ScalablyTyped?

Krišjānis Veinbahs
@kshaa

Ah. I see that the published ScalablyTyped Scala.js React component artifact consists of an SJS JAR and a POM file referring to dependencies on org.scalablytyped.... I guess the solution to my problem might be to also publish these ScalablyTyped-generated packages from the cache into the Maven repository alongside my component. That way whomever imports my component would have everything ready and available and wouldn't need to depend on ScalablyTyped - thereby making my component standalone.

P.S. Sorry for the rubber duck debugging :D

Øyvind Raddum Berg
@oyvindberg
@kshaa this is the preferred workflow for distributing libraries which uses ST https://scalablytyped.org/docs/library-developer
Krišjānis Veinbahs
@kshaa
@oyvindberg That indeed fixes my problems. Thanks! :bow:
Øyvind Raddum Berg
@oyvindberg
Hey everybody, I've finally had some time for ST again. I want to showcase two upcoming changes, which together should make the generated code way easier to work with! See ScalablyTyped/Converter#485 and ScalablyTyped/Converter#487
elkhadirzyad
@elkhadirzyad
hello @oyvindberg , i hope u r in good shape, i'm trying to use "react-dnd" -> "11.1.3" with addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta39") but it gives me the error
[error] (hicpBasicComponentsJS / stImport) TsHelperFile(InFile(/home/asaunix/git/hicp-sales-tool/hicp-basic-components/js/target/scala-2.13/scalajs-bundler/main/node_modules/redux/index.d.ts),FromFolder(InFolder(/home/asaunix/git/hicp-sales-tool/hicp-basic-components/js/target/scala-2.13/scalajs-bundler/main/node_modules/redux),TsIdentLibrarySimple(redux)),IArray(TsIdentModule(None,List(redux)), TsIdentModule(None,List(redux)))) -> Right(Parse error at 402.32 end of input expected)
tomzheng77
@tomzheng77
just want to say a huge thanks for this project! its so good its almost creepy, saved me tens, no likely hundreds of hours of porting the latest three.js and pixi.js
Øyvind Raddum Berg
@oyvindberg
Thanks @tomzheng77 <3
tomzheng77
@tomzheng77
I have a question. has anyone got sbt test working with scalablytyped? I'm a little stumped because the test command by default doesn't build a bundle
tomzheng77
@tomzheng77
I've made some progress now using requireJsDomEnv in Test := true, but the tests still aren't running for some reason. likely just a mistake in my setup though
Alexis Hernandez
@AlexITC
sbt test shouldn't have any issues with scalablytyped
This project uses scalablytyped and executes tests without issues, feel free to check the settings https://github.com/wiringbits/scala-webapp-template
tomzheng77
@tomzheng77
Thanks. Will try
Rob W
@robmwalsh
Hi, Thanks for the awesome project! It's saved me from writing a huge amount of boring boilerplate! Unfortunately it looks like I've finally hit a snag. I've been using ST to start writing a VSCode extension and it's been working fine for basic extension functionality, but I've started trying to add language server support and seem to be missing some types that I need for the most simple example (https://github.com/microsoft/vscode-extension-samples/blob/ddae6c0c9ff203b4ed6f6b43bfacdd0834215f83/lsp-sample/client/src/extension.ts#L9-L14). After some digging, I've narrowed it down to this folder - https://github.com/microsoft/vscode-languageserver-node/tree/main/client/src - it seems that everything under common appears to be available in typings.vscodeLanguageclient, but everything under the node folder is missing. Is there some way to point ST at those files and work its magic there too?
Øyvind Raddum Berg
@oyvindberg
@robmwalsh that particular issue is tracked here ScalablyTyped/Converter#463 . I've started work to fix it, but it'll be a while until it's all ready.
I can come up with a workaround probably by editing files in the node_modules folder, but on mobile now
Rob W
@robmwalsh
@oyvindberg thanks, I did search the issues but not specifically for vscode-languageclient because i thought it was a little too specific! I do appreciate the offer of a workaround but unless that is going to help you understand the underlying issue, please save your time for fixing the underlying issue :) Looks like it's only about 100 loc that's missing and I only actually need to use part of that so it shouldn't be too difficult to manually facade for now.
Rob W
@robmwalsh
My biggest issue is that I know very little about JS other than it's humanity's punishment for our sins, and I was hoping I could keep it that way using ST :p. Alas, it seems I need to have some understanding if I want to make things work. Spent a couple of hours skipping through some es6 and typescript tutorials yesterday and I now far better understand the facade patterns and how scalajs relates to js and how typescript relates to js. Key takeaway for me is it at the type level, neither really does - both scalajs and typescript are really just using phantom types to track whats going on in JS land. I do suspect there's some nicer abstraction hiding here to inspect the structure of traits and derive conversions between compatible types rather than manually casting things. That's one to put into the bottom draw for the time being though, I already have way too many projects on the go atm!
mrt
@ak5fc:matrix.org
[m]

Hi. First thanks for this nice setup instructions for ScalablyTyped. I'm new to JS and Scala.js and got a bit overwhelmed by the instructions for React-Native, Expo, Slinky, with templates here and there etc., and how it all fits together. I now tried to set up ScalablyTyped for a React-Native project that I did set up according to the integration with existing app instructions. The whole project is in Scala 3. I have a configured ScalablyTyped into my SBT project as follows

lazy val root = (project in file("."))
  .enablePlugins(ScalablyTypedConverterPlugin)
  .settings(
    name := "my-app",
    version := "0.0.1",
    scalaVersion := "3.0.2",
    organization := "de.myapp",
    Compile / npmDependencies ++= Seq(
      "react-router-dom" -> "5.3.3",
      "@types/react-router-dom" -> "5.3.3",
    ),
    stFlavour := Flavour.SlinkyNative,
    useYarn := true,
    // This is an application with a main method
    scalaJSUseMainModuleInitializer := true,
    libraryDependencies ++= Seq(
      // Application libraries
      "org.scalatest" %%% "scalatest" % "3.2.14" % Test,
    ),
  )

But when I run sbt test (which shouldn't do anything, as there are no tests or code yet) I do get

[error] stack trace is suppressed; run last update for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.scala-js:scalajs-library_3:1.3.0
[error]   Not found                                                                                                                                                                                       
[error]   Not found                                                                                                                                                                                       
[error]   not found: /home/devel/.ivy2/local/org.scala-js/scalajs-library_3/1.3.0/ivys/ivy.xml                                                                                                            
[error]   not found: https://repo1.maven.org/maven2/org/scala-js/scalajs-library_3/1.3.0/scalajs-library_3-1.3.0.pom

A check on search.maven.org reveals that there is no Scala 3 version for the scalajs-library. What confuses me is that I could actually compile with Scala.js on Scala 3 another part of the project without problems. So I guess this library variant does not exist because it is not needed, but still with the ScalablyTyped setup it is requested. Can anybody give me a hint what is wrong?

1 reply
Øyvind Raddum Berg
@oyvindberg
Lorenzo Gabriele
@lolgab
Released mill-scalablytyped 0.1.0 with the bump of Scalablytyped to 1.0.0-beta40
Mathieu Prevel
@mprevel
Hi,
Is there a way to use ScalablyTyped to generate a facade without having to use webpack bundler ?
I mean, I'd like to notify the plugin or sbt that the npm dependency will be provided at runtime.
This is a use case I commonly encounter. For example, when using a library that is provided by a CDN (authentication, charts libs, ...).
Naftoli Gugenheim
@nafg
Mathieu Prevel
@mprevel
I've tried this (may be I've missed something) but it was still emitting js with "require".
Sébastien Doeraene
@sjrd
PR to add tutorials on how to get started with Scala.js, Vite, Laminar and ScalablyTyped to scala-js.org : scala-js/scala-js-website#590
Comments welcome!
Domas Poliakas
@domaspoliakas:matrix.org
[m]

Hello folks!

I'm trying to port https://github.com/microsoft/vscode-extension-samples/blob/main/lsp-sample/client/package.json to scala.js, I've got scalably typed set up (along with sjs bundler) and I've got the dependencies in my build.sbt to match:

      Compile / npmDependencies ++= List(
        "vscode-languageclient" -> "8.0.2",
      ),
      Compile / npmDevDependencies ++= List(
        "@types/vscode" -> "1.73.1"
      ),
      stIncludeDev := true,

However, I'm failing to replicate this import https://github.com/microsoft/vscode-extension-samples/blob/main/lsp-sample/client/src/extension.ts#L9-L14

import {
    LanguageClient,
    LanguageClientOptions,
    ServerOptions,
    TransportKind
} from 'vscode-languageclient/node';

I don't really understand what the /node is at the import there, and browsing symbols generated by scalably-typed I don't see a LanguageClient. Does anyone know what I need to do here to get those /node symbols available?

Øyvind Raddum Berg
@oyvindberg
Hi there @domaspoliakas:matrix.org - sorry about the belated answer. This is ScalablyTyped/Converter#463 - I hope to have time to fix it relatively soon
Domas Poliakas
@domaspoliakas:matrix.org
[m]
Understood, thanks!
Naftoli Gugenheim
@nafg
Hi, what's the MUI story?
Øyvind Raddum Berg
@oyvindberg
@nafg It's not moving very fast. The stable version is the same as before: version 3. That said, I was very close to being up to speed to (then current) version 5 a year ago. You can see all the generated code for slinky/scalajs-react and build it locally for Scala 2/3 from st-material-ui
So what stopped me was that in addition to the immense size of material-ui itself, you also need a nice interface for their styled-components-like library (forgot the name right now). If you check out examples for mui5 you'll see that almost every example uses that in some manner
and well, ideally we would have some nicely typed interface for that. That interface necessarily brings in all of CSS, and we need to pair that with the generated components coming out of ST. Ideally it should work with components defined outside too, though that may be pushing it
Note that the size of the material-ui components is already pushing it quite far. If I'm not mistaken, the scaladoc jars for the generated code in that repo was more than two gigabytes