diff --git a/importer/src/test/scala/org/scalablytyped/converter/internal/ts/parser/ParserTests.scala b/importer/src/test/scala/org/scalablytyped/converter/internal/ts/parser/ParserTests.scala index 79185d860f..1cbe44b65b 100644 --- a/importer/src/test/scala/org/scalablytyped/converter/internal/ts/parser/ParserTests.scala +++ b/importer/src/test/scala/org/scalablytyped/converter/internal/ts/parser/ParserTests.scala @@ -2759,4 +2759,54 @@ export {}; ), ) } + + test("function isNotTestHost([, sectionItem]: ConfigurationSectionEntry): boolean;") { + val content = "declare function isNotTestHost([, sectionItem]: ConfigurationSectionEntry): boolean" + shouldParseAs(content, TsParser.tsDeclFunction)( + TsDeclFunction( + NoComments, + true, + TsIdentSimple("isNotTestHost"), + TsFunSig( + NoComments, + IArray(), + IArray( + TsFunParam( + NoComments, + TsIdentSimple("hasSectionItem"), + Some(TsTypeRef(NoComments, TsQIdent(IArray(TsIdentSimple("ConfigurationSectionEntry"))), IArray())), + ), + ), + Some(TsTypeRef.boolean), + ), + Zero, + CodePath.NoPath, + ), + ) + } + + test("function foo({ 'com.foo': _, ...entitlementsPlist }: Plist): Plist") { + val content = "declare function foo({ 'com.foo': _, ...entitlementsPlist }: Plist): Plist" + shouldParseAs(content, TsParser.tsDeclFunction)( + TsDeclFunction( + NoComments, + true, + TsIdentSimple("foo"), + TsFunSig( + NoComments, + IArray(), + IArray( + TsFunParam( + NoComments, + TsIdentSimple("hasCom.apple.developer.contacts.notesEntitlementsPlist"), + Some(TsTypeRef(NoComments, TsQIdent(IArray(TsIdentSimple("Plist"))), IArray())), + ), + ), + Some(TsTypeRef(NoComments, TsQIdent(IArray(TsIdentSimple("Plist"))), IArray())), + ), + Zero, + CodePath.NoPath, + ), + ) + } } diff --git a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/parser/TsParser.scala b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/parser/TsParser.scala index 151a43ded0..2607961a67 100644 --- a/ts/src/main/scala/org/scalablytyped/converter/internal/ts/parser/TsParser.scala +++ b/ts/src/main/scala/org/scalablytyped/converter/internal/ts/parser/TsParser.scala @@ -386,12 +386,12 @@ class TsParser(path: Option[(os.Path, Int)]) extends StdTokenParsers with Parser /** Represent in tree? **/ lazy val destructuredObj: Parser[TsIdentSimple] = - "{" ~>! rep((tsIdent | ("..." ~> tsIdent)) <~ (":" <~ (tsIdent | destructured)).? <~ ",".?) <~ "}" ^^ ( + "{" ~>! rep((tsIdentLiberal | ("..." ~> tsIdent)) <~ (":" <~ (tsIdent | destructured)).? <~ ",".?) <~ "}" ^^ ( ids => TsIdent("has" + ids.map(_.value.capitalize).mkString("")), ) lazy val destructuredArray: Parser[TsIdentSimple] = - "[" ~>! repsep(tsIdent <~ (":" <~ (tsIdent | destructured)).?, ",") <~ "]" ^^ ( + "[" ~>! ",".? ~> repsep(tsIdent <~ (":" <~ (tsIdent | destructured)).?, ",") <~ "]" ^^ ( ids => TsIdent("has" + ids.map(_.value.capitalize).mkString("")), )