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
not that I've tested that much
Naftoli Gugenheim
@nafg
cool
Øyvind Raddum Berg
@oyvindberg
this is really really great, it means I've finally about reached parity with how I like to do things in typescript
elkhadirzyad
@elkhadirzyad
hello @oyvindberg , the compilation of mui5 project takes a long time, any solution
Øyvind Raddum Berg
@oyvindberg
possibly
oyvindberg/st-material-ui@00a1ef6 I just pushed this to master, it really really improved experience in intellij. maybe it also helps scalac?
Øyvind Raddum Berg
@oyvindberg
https://github.com/oyvindberg/st-material-ui-demo is 2-3 seconds to compile on my M1 machine now
elkhadirzyad
@elkhadirzyad
thanks @oyvindberg , it works with scala 2.13 ?
Øyvind Raddum Berg
@oyvindberg
no
it uses ScalablyTyped/Converter#487 to achieve much, much better API, and that doesn't work with 2.13 since it doesn't have @targetName
once I merge that with some fallback functionality for 2.13 it'll be possible to build st-material-ui for 2.13 again
but that fallback functionality doesn't exist yet
elkhadirzyad
@elkhadirzyad
ok @oyvindberg thanks again for the explanation , for the old repo, there is no way to expedite the publish? i eliminate the slinky version but it still slow
Øyvind Raddum Berg
@oyvindberg
you mean to build st-material-ui itself? no, that takes a while unfortunately
elkhadirzyad
@elkhadirzyad
yes, because it is the only way to make it work with 2.13 scala version
Øyvind Raddum Berg
@oyvindberg
the three commits from december 15th should help that compile quite a bit by the way, come to think of it. https://github.com/oyvindberg/st-material-ui/commits/master
or well, you're not generating code yourself. in that case no dice
disabling scaladoc should help a lot
elkhadirzyad
@elkhadirzyad
@oyvindberg thanks, ill try to disable scaladoc and c what happen
Øyvind Raddum Berg
@oyvindberg
Do that. It builds in 8-9 minutes in GitHub actions now
Øyvind Raddum Berg
@oyvindberg
Raphael Mäder
@randm-ch

Hi all. I'm getting this._config is undefined when using Bootstrap Carousel via Scalablytyped. Is this a known issue? How can I resolve it?
I tried all the imports I could think of (e.g. typings.bootstrap.mod.Carousel, currently I'm trying to use

import typings.bootstrap.jsDistCarouselMod.{default => Carousel}
new Carousel("carouselId") // Also tried new Carousel("carouselId", PartialOptions())

In the build.sbt I have these NPM deps (useYarn is true):

"@popperjs/core"   -> "2.11.6", // bootstrap dependency
"bootstrap"        -> "5.2.3",
"@types/bootstrap" -> "5.2.6"

Thanks!

Øyvind Raddum Berg
@oyvindberg
no idea @randm-ch unfortunately. you'll probably have to debug it in the browser and see if you can figure out where that _config should have come from. One thing that may help may be to touch typings.bootstrap.bootstrapRequire first in your code, so it includes the whole thing
Raphael Mäder
@randm-ch

Thanks for the answer. Yeah I did include typings.bootstrap.bootstrapRequirebut it doesn't help. From the JS code I see:

constructor(element, config) {
    super(element, config)

    this._interval = null
    this._activeElement = null
    this._isSliding = false
    this.touchTimeout = null
    this._swipeHelper = null

    this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)
    this._addEventListeners()
   ...
}

and then

_addEventListeners() {
    if (this._config.keyboard) {
    ...
}

where it fails to get the this._config value. But it should be set in super(element, config) if I'm not mistaken.

Yes indeed. In the BaseComponent constructor we have this._config = this._getConfig(config) and the _getConfig method does some magic which should default the config if it's not present... I'll try to figure out why it doesn't get set once I have some time. Thanks for the pointers :)
Raphael Mäder
@randm-ch
I fell back to use a data-bs-ride="carousel" instead of initializing manually, which works just fine :+1:
Philipp Dörfler
@phdoerfler
Hi all, just wanted to say thanks for the wonderful converter and wish y'all happy holidays and a wonderful new year :)
Øyvind Raddum Berg
@oyvindberg
thanks @phdoerfler - Same to you! :)
Arindam Ray
@ArindamRayMukherjee

Hi, trying to get ScalablyTyped to generate scala.js types for Realm(https://www.mongodb.com/docs/realm/sdk/react-native/quick-start/) for a mobile project of mine.
I've done the following
Added addSbtPlugin("org.scalablytyped.converter" % "sbt-converter" % "1.0.0-beta40") to plugins.sbt
Added the following to build.sbt

enablePlugins(ScalablyTypedConverterPlugin)
Compile / npmDependencies ++= Seq(
  "@realm/react" -> "0.4.1"
)
stFlavour := Flavour.SlinkyNative
useYarn := true

I get a hundreds of warnings of the type below

[warn] QualifyReferences.scala:72 msg Couldn't qualify React.ReactNode [thread => 291, project => app, ms => 9416, phase => typescript, scope => TreeScope(TsParsedFile() / TsDeclModule(@realm/react/dist/RealmProvider) / TsDeclTypeAlias(ProviderProps) / TsTypeIntersect() / TsTypeObject() / TsMemberProperty(children) / TsTypeRef()), id => @realm/react]
[warn] TsTreeScope.scala:84  Cannot resolve TsQIdent(IArray(TsIdentSimple(React), TsIdentSimple(FC))) [thread => 291, project => app, ms => 9416, phase => typescript, scope => TreeScope(TsParsedFile() / TsDeclModule(@realm/react/dist/UserProvider) / TsExport() / Tree() / TsDeclVar(UserProvider) / TsTypeRef()), id => @realm/react]

What could I be doing better?

Øyvind Raddum Berg
@oyvindberg
Add @types/react
Arindam Ray
@ArindamRayMukherjee
Okies... side Q, do I have to add it explicitly to both package.json and build.sbt npmDependencies ? Or just adding it to build.sbt npmDependencies will suffice?
Arindam Ray
@ArindamRayMukherjee
Also I could not find how to force a regeneration. If I add extra libs like above to remove some of the warnings, how do I ask it to repeat the generation without cleaning caches by hand?
Arindam Ray
@ArindamRayMukherjee

Last Q for the day
Running things further with stc @realm/react @types/react I get to errors like so

[error] 2022-12-30T09:40:56.313209Z Phase3Compile.scala:152 err Compiling realm (46 Scala sources)
[E] [E2] src/main/scala/typings/realm/Realm.scala:1552:10
[E]      UUID is already defined as type UUID
[E]      L1552:     type UUID = typings.bson.mod.UUID
[E]                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E] [E1] src/main/scala/typings/realm/Realm.scala:1528:10
[E]      Decimal128 is already defined as type Decimal128
[E]      L1528:     type Decimal128 = typings.bson.mod.Decimal128
[E]                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[E] src/main/scala/typings/realm/Realm.scala: L1528 [E1], L1552 [E2]

Ignoring realm seems not an option as the typings generated are have js.Any everywhere. What are my options here?

Øyvind Raddum Berg
@oyvindberg
@ArindamRayMukherjee that is a bug in ST you're seeing, and you're seeing it generate code which does not compile
I tried it locally with these dependencies:
{
  "dependencies": {
    "@realm/react": "^0.4.1",
    "@types/react": "^18.0.26",
    "typescript": "^4.9.4"
  }
}
then it worked. check that you're using the newest version of ST as well
Øyvind Raddum Berg
@oyvindberg
Or, I see you need realm as well. You can work around that bug by adding bson to stIgnore
Eric Weise
@eweise
Hi. I'm just starting out with scala.js and trying to use ScalablyTyped with charts.js. Wondering if someone can show me how to return valid callback function with this signature
var callback: js.UndefOr[
    js.Function3[
      /* value */ Double | String, 
      /* index */ Double, 
      /* values */ js.Array[Double | String], 
      js.UndefOr[String | Double | Null]
    ]
  ] = js.undefined
Lorenzo Gabriele
@lolgab

@eweise You can pass a Scala Function like:

val NestedTickOptions = new NestedTickOptions {
  callback = (value, index, values) => 1.0
}

since there are some implicit conversions from scala.FunctionN to js.FunctionN in Scala.js
Since NestedTickOptions is a trait with vars having js.undefined as default you override the default with callback =
Or you can use the Scalablytyped builder:

val NestedTickOptions = NestedTickOptions().setCallback((value, index, values) => 1.0)
Eric Weise
@eweise
Thanks for the help @lolgab . looks straightforward
Øyvind Raddum Berg
@oyvindberg
1.0.0-beta41 is out, mostly a bugfix release
Lorenzo Gabriele
@lolgab
Published mill-scalablytyped 0.1.4 with this 1.0.0-beta41
cyz
@cyz1901

hello team.I add"popmotion": "~8.7.1"to dependencies
After conversion, I want to use

          import typings.popmotion.tweenMod.*
          import typings.popmotion.tweenTypesMod.TweenProps
          default(TweenProps().setFrom(0).setTo(100)).start()

but i found

18:55:30 [vite] Internal server error: Failed to resolve import "popmotion/lib/animations/tween" from "target/scala-3.1.3/testProject-fastopt/per.com.testProject.pages.HomeView$.js". Does the file exist?
  Plugin: vite:import-analysis
  File: /Users/computer/MyProject/testProject/target/scala-3.1.3/testProject-fastopt/per.com.testProject.pages.HomeView$.js
  1  |  "use strict";
  2  |  import * as $i_popmotion$002flib$002fanimations$002ftween from "popmotion/lib/animations/tween";
     |                                                                 ^
  3  |  import * as $j_internal$002db18e8fdf434ff99927b6d0c4b454a8a67b95d3c9 from "./internal-b18e8fdf434ff99927b6d0c4b454a8a67b95d3c9.js";
  4  |  import * as $j_internal$002db28b7af69320201d1cf206ebf28373980add1451 from "./internal-b28b7af69320201d1cf206ebf28373980add1451.js";

I think it is because the imported file in the generated js file is not the original js file but the d.ts file
Is there any way to solve this problem?

2 replies
Øyvind Raddum Berg
@oyvindberg
@cyz1901 try to go through typings.popmotion.mod instead
1 reply
Andriy Massimilla
@andriygm
image.png
Trying to integrate fontawesome with Laminar, and running into an issue where the AbstractElement trait generated has an attributes field of type Any -- I would expect this field to contain an array of key value pairs or something similar, or am I missing something?
Øyvind Raddum Berg
@oyvindberg
@andriygm it just means that it's untyped in typescript, and we have no other type in scala to represent that. Or well, we could have used js.Dynamic. You get to choose your own types, heh
Andriy Massimilla
@andriygm
@oyvindberg I figured as much — so will this field have data? Would I be able to cast it to a js.Dictionary?
Øyvind Raddum Berg
@oyvindberg
I have no idea, documentation will likely explain what it's used for. Typically you console.warn it to have a look