Skip to content

Commit

Permalink
Fix warnings for typeof globalThis and empty exports in namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindberg committed Apr 22, 2020
1 parent f513340 commit 3a3d094
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class ReplaceExports(loopDetector: LoopDetector) extends TreeTransformationScope
case other =>
scope.logger.fatal(s"Unexpected $other")
}
case TsExport(NoComments, _, ExportType.Named, TsExporteeNames(Empty, None)) =>
Empty
case e: TsExport =>
scope.fatalMaybe(s"Dropping unexpected export in namespace $e")
Empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import org.scalablytyped.converter.internal.ts.TsTreeScope.LoopDetector
import org.scalablytyped.converter.internal.ts.modules.{DeriveCopy, ReplaceExports}

object ResolveTypeQueries extends TransformLeaveMembers with TransformLeaveClassMembers {
val GlobalThis = TsQIdent.of("globalThis")

def newClassMembersLeaving(scope: TsTreeScope, tree: HasClassMembers): IArray[TsMember] =
tree.members.flatMap {
case target @ TsMemberProperty(
Expand Down Expand Up @@ -192,6 +194,9 @@ object ResolveTypeQueries extends TransformLeaveMembers with TransformLeaveClass

case Right(loopDetector) =>
target.expr match {
case GlobalThis =>
TsTypeRef.any.copy(comments = Comments(Comment("/* globalThis */ ")))

case wanted if TsQIdent.Primitive(wanted) => TsTypeRef(NoComments, wanted, Empty)
case wanted =>
val found = scope
Expand Down

0 comments on commit 3a3d094

Please sign in to comment.