Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 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)

  • May 23 21:03

    oyvindberg on sbt-tpolecat-0.3.1

    Update sbt-tpolecat to 0.3.1 (compare)

  • May 23 21:03

    oyvindberg on scalatest-3.2.9

    (compare)

  • May 23 21:02

    oyvindberg on master

    Update sbt-bloop to 1.5.0 (#439) (compare)

  • May 23 21:00

    oyvindberg on master

    Update sbt-mdoc to 2.3.2 (#429) (compare)

  • May 23 20:56

    oyvindberg on master

    Update sourcecode to 0.2.8 (#40… (compare)

  • May 23 20:54

    oyvindberg on sourcecode-0.2.8

    Update sourcecode to 0.2.8 disable checksums (compare)

  • Mar 11 18:58

    oyvindberg on master

    Update sbt-sonatype to 3.9.12 (… (compare)

  • Mar 11 18:58

    oyvindberg on master

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

Øyvind Raddum Berg
@oyvindberg
The distribution repo is now used for reference, really. And it's used by me to track changes
Matt Hughes
@matthughes
In scalajs-react 1.x, Callback was in the main package react, not it's in react.callback.Callback. Not 100% sure how this works, but if you just use the "core" module, Callback is in the historic location. But if you use callback/core-bundle-cats_effect, it's in the new callback package. Is there a way to make the compiler see react.callback.Callback as react.Callback?
Matt Hughes
@matthughes
What is the benefit of using a remote cache vs publishing the library to your artifact repository (Nexus/Artifactory/etc)?
Matt Hughes
@matthughes

Think of it like a maven repo with transient libraries, where if they are not found the plugin will automatically rebuild them locally.

I guess if you're iterating and adding libraries it helps. My current approach is I have a separate project that contains all the sjs library facades that I plan to use in my downstream project. Since that doesn't change much, I'll just modify/recompile/republish any time I need to add/change libraries.

Alexander Samsig
@asamsig:matrix.org
[m]

The advantage is that it is less work, than publishing a library, especially if you're not sitting with an internal repo already.

I'd prefer to your approach any day in an organization, but you're doing open source work or a hobby project remote cache is handy.

Matt Hughes
@matthughes
That makes sense
Fabio Pinheiro
@FabioPinheiro
@oyvindberg quick question, you probably already answer somewhere.
When we get the following warning on the code generation:
import warning: transforms.QualifyReferences#resolveTypeRef many Couldn't qualify some type
Is there a good reason to return Any instead of js.Any
Øyvind Raddum Berg
@oyvindberg
It was recently changed from js.Any to Any because usage of the former apparently is discouraged @FabioPinheiro
Fabio Pinheiro
@FabioPinheiro
Thanks for the feedback.
I wasn't aware of that change.
Øyvind Raddum Berg
@oyvindberg
elkhadirzyad
@elkhadirzyad
hello @oyvindberg , is there a chance to see mui 5 by the end of this month ?
Øyvind Raddum Berg
@oyvindberg
@elkhadirzyad I've been sidetracked and is currently working on something else. If you want that effort to continue faster you can test what's already there in the branch I linked last time you asked and provide feedback on it
elkhadirzyad
@elkhadirzyad
thanks @oyvindberg , it is working just for scalaVersion := "3.1.0" ?
Alexis Hernandez
@AlexITC
you can consume scala3 artifacts in scala 2.13 (see https://docs.scala-lang.org/scala3/guides/migration/compatibility-classpath.html)
elkhadirzyad
@elkhadirzyad
@AlexITC thanks
Øyvind Raddum Berg
@oyvindberg
@elkhadirzyad it has scala 2 sources as well, just change to a 2.13 scala version in the build
elkhadirzyad
@elkhadirzyad
@oyvindberg on st-material-ui-master when i try to do sbt -mem 8000 publishLocal, i got java.lang.OutOfMemoryError: Java heap space
elkhadirzyad
@elkhadirzyad
@oyvindberg it is good, i got the library publication
mvillafuertem
@mvillafuertem
Hi @oyvindberg, with the last beta, I am getting some errors. Any clue?
scalaVersion := "2.13.8"

addSbtPlugin("org.scala-js"                % "sbt-scalajs"              % "1.10.0")
addSbtPlugin("org.scalablytyped.converter" % "sbt-converter"            % "1.0.0-beta37")

polymorphic expression cannot be instantiated to expected type;
[error]  found   : [T]typings.reactstrap.components.SharedBuilder_UncontrolledDropdownProps1835145360[typings.reactstrap.mod.UncontrolledDropdown[T],T]
[error]  required: japgolly.scalajs.react.vdom.html_<^.TagMod
[error]     (which expands to)  japgolly.scalajs.react.vdom.TagMod
[error]       UncontrolledDropdown()(


type mismatch;
[error]  found   : String
[error]  required: ? | scala.scalajs.js.Array[?]
[error]             Route(RouteProps().setExact(true).setPath(s"${routeMatch.path}/register")).withKey("register")(RegisterPage.component()),
/* The props of this component has an unsupported shape. You can use `set` manually to use it, but with no compiler support :/ . Couldn't find props for (typings.reactRouter.mod.RouteProps[Path, typings.reactRouter.mod.ExtractRouteParams[Path, java.lang.String]]) & (typings.reactRouter.mod.OmitNative[
T, 
/ * keyof react-router.react-router.RouteProps<string, react-router.react-router.ExtractRouteParams<string, string>> * / typings.reactRouter.reactRouterStrings.location_ | typings.reactRouter.reactRouterStrings.component | typings.reactRouter.reactRouterStrings.render | typings.reactRouter.reactRouterStrings.children | typings.reactRouter.reactRouterStrings.path | typings.reactRouter.reactRouterStrings.exact | typings.reactRouter.reactRouterStrings.sensitive | typings.reactRouter.reactRouterStrings.strict]) because: IArray(Could't extract props from T because couldn't resolve ClassTree.) */
object Route {

  def apply[T /* <: js.Object */, Path /* <: String */](
    p: (RouteProps[Path, ExtractRouteParams[Path, String]]) with (OmitNative[
      T, 
      /* keyof react-router.react-router.RouteProps<string, react-router.react-router.ExtractRouteParams<string, string>> */ location_ | typings.reactRouter.reactRouterStrings.component | render | children | path | exact | sensitive | strict
    ])
  ): Builder[T, Path] = new Builder[T, Path](js.Array(this.component, p.asInstanceOf[js.Any]))

  @JSImport("react-router-dom", "Route")
  @js.native
  val component: js.Object = js.native

  @scala.inline
  class Builder[T /* <: js.Object */, Path /* <: String */] (val args: js.Array[Any])
    extends AnyVal
       with StBuildingComponent[typings.reactRouterDom.mod.Route[T, Path]]

  implicit def make[T /* <: js.Object */, Path /* <: String */](companion: Route.type): Builder[T, Path] = new Builder[T, Path](js.Array(this.component, js.Dictionary.empty))()
}
Øyvind Raddum Berg
@oyvindberg
If it's s builder which isn't implicitly converted to a TagMod then you can call .build on it explicitly
mvillafuertem
@mvillafuertem
nice, one of them has been solved, but I keep getting this error for the Route component... 😕
type mismatch;
[error]  found   : String
[error]  required: ? | scala.scalajs.js.Array[?]
[error]             Route(RouteProps().setExact(true).setPath(s"${routeMatch.path}/register")).withKey("register")(RegisterPage.component()),
mvillafuertem
@mvillafuertem
I just saw that I get this error in Flavour.ScalajsReact projects
mvillafuertem
@mvillafuertem
but with the same versions, but different flavor Flavour.Slinky the converter generate a different facade

/* The props of this component has an unsupported shape. You can use `set` manually to use it, but with no compiler support :/ . Could't extract props from T because couldn't resolve ClassTree. */
object Route {

  def apply[T /* <: RouteProps */](p: T): Builder[T] = new Builder[T](js.Array(this.component, p.asInstanceOf[js.Any]))

  @JSImport("react-router-dom", "Route")
  @js.native
  val component: js.Object = js.native

  @scala.inline
  class Builder[T /* <: RouteProps */] (val args: js.Array[Any])
    extends AnyVal
       with StBuildingComponent[tag.type, typings.reactRouterDom.mod.Route[T]]

  implicit def make[T /* <: RouteProps */](companion: Route.type): Builder[T] = new Builder[T](js.Array(this.component, js.Dictionary.empty))()
}
mvillafuertem
@mvillafuertem

Hi @oyvindberg, I found the problem, yarn add @types/react-router-dom@5.1.2 transiently installs the @types/react-router@5.1.18 version, which generates a weird facade, it was necessary to explicitly set the version of @types/react-router to 5.1.2.

Another thing is that the stIgnore option apparently doesn't ignore if the version is added, right? because I was trying to exclude the wrong version and apparently it didn't work.

 stIgnore ++= List("@types/react-router@5.1.18")
Øyvind Raddum Berg
@oyvindberg
yeah, no. dependency resolution runs in npm before the converter does its work.
and I've seen that react-router problem. a lot of libraries like it have started to employ very advanced type-level patterns for things like this, it really should be simplified somehow during translation
just imagine, iirc it parses the route string (compile-time), extracts parameters names, and returns an object type you can dig into in code with those names set
Sébastien Doeraene
@sjrd
Hey! I'm looking at https://scalablytyped.org/docs/plugin-no-bundler#implement-externalnpm , and I have a question about it.
If I use it as is (but with npm install), the command runs on every compile, which takes quite some time, and outputs quite a bit of useless logs every time.
Instead, I opted to just have externalNpm := baseDirectory.value.
And I run npm install once before running sbt.
Is this bad?
Anton Sviridov
@velvetbaldmime:matrix.org
[m]

@oyvindberg: Howdy! before I pop this on the issue (this one? ScalablyTyped/Converter#125), can you confirm that this code:

export type PascalCasedProperties<Value> = Value extends Function
    ? Value
    : Value extends Array<infer U>
    ? Value
    : {[K in keyof Value as PascalCase<K>]: Value[K]};

which fails to parse with ScalablyTyped (Right(Parse error at 51.22 '']'' expected but 'as' found)) is broken for the same reason as the issue I linked?

Ø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
Jamal CHAQOURI
@redarqas_gitlab
Thank you @oyvindberg for the explanation. Casting between these types is what I ended up by doing