From 818d793b2ec32f7a6e74ae6c47a19994c8b1481c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Raddum=20Berg?= Date: Sat, 27 Feb 2021 13:39:01 +0100 Subject: [PATCH] Limit how many fake literal string creator methods we output (fixes https://github.com/ScalablyTyped/ScalaJsReactDemos/pull/8 ) --- .../internal/scalajs/transforms/FakeLiterals.scala | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/FakeLiterals.scala b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/FakeLiterals.scala index eddcaf75a5..dd95fb7819 100644 --- a/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/FakeLiterals.scala +++ b/scalajs/src/main/scala/org/scalablytyped/converter/internal/scalajs/transforms/FakeLiterals.scala @@ -51,8 +51,8 @@ object FakeLiterals { if (collected.isEmpty) None else { val members = - collected.flatMap { - case (underlying: ExprTree.Lit, name) => + collected.zipWithIndex.flatMap { + case ((underlying: ExprTree.Lit, name), idx) => val codePath = tree.codePath + moduleName + name val `trait` = ClassTree( @@ -69,7 +69,7 @@ object FakeLiterals { codePath, ) - val `def` = + def `def` = MethodTree( IArray(Annotation.Inline), ProtectionLevel.Default, @@ -83,7 +83,10 @@ object FakeLiterals { codePath, isImplicit = false, ) - List(`trait`, `def`) + + // for instance @expo/vector-icons has 11500 different literal strings, + // and it causes: Class too large: typings/expoVectorIcons/expoVectorIconsStrings + if (idx <= 10000) List(`trait`, `def`) else List(`trait`) } Some(