[
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build & Test\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n  # Allows you to run this workflow manually from the Actions tab\n  workflow_dispatch:\n\njobs:\n  build:\n    runs-on: ${{ matrix.os }}\n    strategy:\n      fail-fast: false\n      matrix:\n        os: [ubuntu-latest, windows-latest]\n        experimental: [false]\n        emacs-version: [26.3, 27.2, 28.2, 29.4, 30.2]\n        include:\n        - emacs-version: snapshot\n          experimental: true\n          os: ubuntu-latest\n        - emacs-version: snapshot\n          experimental: true\n          os: windows-latest\n    continue-on-error: ${{ matrix.experimental }}\n\n    steps:\n      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it\n      - uses: actions/checkout@v6\n\n      - uses: jcs090218/setup-emacs@master\n        with:\n          version: ${{ matrix.emacs-version }}\n\n      - uses: emacs-eask/setup-eask@master\n        with:\n          version: 'snapshot'\n\n      - name: Run a multi-line script\n        run: |\n          emacs --version\n          make build\n          make test\n"
  },
  {
    "path": ".gitignore",
    "content": "\n# Created by https://www.gitignore.io/api/emacs,windows,linux\n\n### Emacs ###\n# -*- mode: gitignore; -*-\n*~\n\\#*\\#\n/.emacs.desktop\n/.emacs.desktop.lock\n*.elc\nauto-save-list\ntramp\n.\\#*\n\n# Org-mode\n.org-id-locations\n*_archive\n\n# flymake-mode\n*_flymake.*\n\n# eshell files\n/eshell/history\n/eshell/lastdir\n\n# elpa packages\n/elpa/\n\n# reftex files\n*.rel\n\n# AUCTeX auto folder\n/auto/\n\n# eask packages\n.eask/\ndist/\n\n# Flycheck\nflycheck_*.el\n\n# server auth directory\n/server/\n\n# projectiles files\n.projectile\n\n# directory configuration\n.dir-locals.el\n\n### Linux ###\n\n# temporary files which can be created if a process still has a handle open of a deleted file\n.fuse_hidden*\n\n# KDE directory preferences\n.directory\n\n# Linux trash folder which might appear on any partition or disk\n.Trash-*\n\n# .nfs files are created when an open file is removed but is still being accessed\n.nfs*\n\n### Windows ###\n# Windows thumbnail cache files\nThumbs.db\nehthumbs.db\nehthumbs_vista.db\n\n# Folder config file\nDesktop.ini\n\n# Recycle Bin used on file shares\n$RECYCLE.BIN/\n\n# Windows Installer files\n*.cab\n*.msi\n*.msm\n*.msp\n\n# Windows shortcuts\n*.lnk\n\n# End of https://www.gitignore.io/api/emacs,windows,linux\n\n# ELPA-generated files.\n/typescript-mode-autoloads.el\n/typescript-mode-pkg.el\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM ubuntu:bionic\n\nRUN apt-get update && \\\n  apt-get install -y \\\n  make curl python git emacs\n\nRUN curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python\nENV PATH=\"/root/.cask/bin:${PATH}\"\n\nRUN mkdir -p /typescript-mode\nCOPY . /typescript-mode\nWORKDIR /typescript-mode\n\nCMD [\"make\", \"test\"]\n"
  },
  {
    "path": "Eask",
    "content": "(package \"typescript-mode\"\n         \"0.4\"\n         \"Major mode for editing typescript\")\n\n(website-url \"http://github.com/ananthakumaran/typescript.el\")\n(keywords \"typescript\" \"languages\")\n\n(package-file \"typescript-mode.el\")\n\n(files \"*.el\")\n\n(source \"gnu\")\n(source \"melpa\")\n\n(depends-on \"emacs\" \"24.3\")\n\n(setq network-security-level 'low)  ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "Makefile",
    "content": "EMACS ?= emacs\nEASK ?= eask\nELS = \\\n  typescript-mode.el \\\n  typescript-mode-test-utilities.el \\\n  typescript-mode-general-tests.el \\\n  typescript-mode-jsdoc-tests.el \\\n  typescript-mode-tests.el\nELCS = $(ELS:.el=.elc)\n\nclean:\n\trm -f $(ELCS)\n\nbuild: clean\n\t$(EASK) compile\n\ntest:\n\t+ $(EMACS) -Q -batch -L . -l typescript-mode-tests.el -f ert-run-tests-batch-and-exit\n\n# end\n"
  },
  {
    "path": "README.md",
    "content": "# typescript.el\n\n![Build & Test](https://github.com/emacs-typescript/typescript.el/workflows/Build%20&%20Test/badge.svg)\n[![MELPA](https://melpa.org/packages/typescript-mode-badge.svg)](https://melpa.org/#/typescript-mode)\n[![MELPA Stable](https://stable.melpa.org/packages/typescript-mode-badge.svg)](https://stable.melpa.org/#/typescript-mode)\n\n`typescript.el` is a major-mode for editing [Typescript](http://www.typescriptlang.org/)-files in [GNU Emacs](https://www.gnu.org/software/emacs/).\n\n`typescript.el` is a self-contained, lightweight and minimalist major-mode\nfocused on providing basic font-lock/syntax-highlighting and\nindentation for Typescript syntax, without any external dependencies.\n\nOutput from `tsc` and `tslint` is also handled seamlessly through\n`compilation-mode`.\n\n## A short note on development HALT\n\nAs the both the JavaScript and TypeScript languages have evolved to become ever more complex, so has the\nElisp codebase for `typescript-mode` trying to correctly handle them.\n\nWe've been at the point for quite some time where it has become increasingly obvious that the current code-base\nsimply cannot continue growing. It will be slow. It will be complex. It will be buggy. It will be head-ache inducing\nto wrap our heads around it, and ... I guess we're already there.\n\nApart from occasional PRs getting merged, the current `typescript-mode` code isn't being developed because almost nobody\nwants to work code of this complexity.\n\n*Essentially all major development of `typescript-mode` has come to a halt.*\n\n## Good news though!\n\nEmacs 29 will ship with support for a parser-library called tree-sitter, and will actually have in-tree\nsupport for TypeScript!  So now you can just use the provided `typescript-ts-mode` and get\nbetter support for TypeScript than `typescript.el` ever provided. This new mode also supports TSX.\n\nDevelopment of TypeScript-support will from now on continue in Emacs core, rather than this repo.\nWe hope you'll like the new experience.\n\n# Installation\n\n`typescript.el` can be installed from source directly using your\nfavourite approach or framework, or from MELPA and MELPA Stable as a\npackage.\n\nTo install typescript.el simply type `M-x package-install<RET>typescript-mode<RET>`.\n\n# Customization\n\nTo customize `typescript.el` just type the following: `M-x customize-group<RET>typescript<RET>`.\n\nYou can add any other customization you like to `typescript-mode-hook`\nin your `init.el` file. `typescript.el` also handles `prog-mode-hook`\non versions of Emacs which supports it.\n\n# Support for Compilation Mode\n\nThis mode automatically adds support for `compilation-mode` so that if\nyou run `M-x compile<ret>tsc<ret>` the error messages are correctly\nparsed.\n\nHowever, the error messages produced by `tsc` when its `pretty` flag\nis turned on include ANSI color escapes, which by default\n`compilation-mode` does not interpret. In order to get the escapes\nparsed, you can use:\n\n```elisp\n(require 'ansi-color)\n(defun colorize-compilation-buffer ()\n  (ansi-color-apply-on-region compilation-filter-start (point-max)))\n(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)\n```\n\nOr, if you prefer, you can configure `tsc` with the `pretty` flag set\nto `false`: `tsc --pretty false`. However, doing this does more than\njust turning off the colors. It also causes `tsc` to produce less\nelaborate error messages.\n\n# Contributing\n\nTo run the tests you can run `make test`.\n\nIf you prefer, you may run the tests via the provided `Dockerfile`.\n\n```bash\ndocker build -t typescript-mode .\ndocker run --rm -v $(pwd):/typescript-mode typescript-mode\n```\n\n# Other Typescript-packages of interest\n\nWhile `typescript.el` may *not* provide a full kitchen-sink, the good\nnews is that there's other packages which do!\n\nMore advanced features can be provided by using these additional\npackages:\n\n* [lsp-mode](https://github.com/emacs-lsp/lsp-mode) - A standards-based\n  code-completion and refactoring backend, based on the\n  [Language Server Protocol (LSP)](https://langserver.org/).\n\n* [tide](https://github.com/ananthakumaran/tide/) - TypeScript\n  Interactive Development Environment for Emacs\n* [ts-comint](https://github.com/josteink/ts-comint) - a Typescript REPL\n  in Emacs.\n\nInitializing these with `typescript.el` will then become a matter of\ncreating your own `typescript-mode-hook` in your `init.el` file.\n"
  },
  {
    "path": "test-files/indentation-reference-document.ts",
    "content": "/// <reference types=\"node\" />\n/// <reference path=\"shared.ts\" />\n/// <reference path=\"session.ts\" />\n// used in fs.writeSync\n/* tslint:disable:no-null-keyword */\n\n/*\n * this file is a butchered copy of TypeScript's tsserver.ts file\n * made to contain the most important syntactical elements\n * of TypeScript to verify indentation-code.\n *\n * It will not build, and that's NOT a problem!\n */\n\n// namespaces indent.\nnamespace ts.server {\n\n    const net: {\n        connect(options: { port: number }, onConnect?: () => void): NodeSocket\n    } = require(\"net\");\n\n    // functions indent.\n    function getGlobalTypingsCacheLocation() {\n        const obj = {\n            case: 1,\n            default: 2\n        };\n    }\n\n    // interfaces and classes indent.\n    interface NodeChildProcess {\n        send(message: any, sendHandle?: any): void;\n        on(message: \"message\" | \"exit\", f: (m: any) => void): void;\n        kill(): void;\n        pid: number;\n    }\n\n    export type SomeType = string | number;\n\n    class Logger implements ts.server.Logger {\n        private firstInGroup = true;\n\n        // parameter-lists are currently not indented like tsserver wants it to...\n        // constructor(private readonly logFilename: string,\n        //     private readonly traceToConsole: boolean,\n        //     private readonly level: LogLevel) {\n        // }\n\n        // function-typed class-members indent.\n        constructor(private readonly logFilename: string) {\n            console.log(\"yes\");\n        }\n\n        static padStringRight(str: string, padding: string) {\n            return (str + padding).slice(0, padding.length);\n        }\n\n        close() {\n            if (this.fd >= 0) {\n                fs.close(this.fd);\n            }\n        }\n    }\n\n    // object initialization/parameter-lists indent.\n    const ioSession = new IOSession(\n        sys,\n        cancellationToken,\n        eventPort,\n        /*canUseEvents*/ eventPort === undefined,\n        useSingleInferredProject,\n        disableAutomaticTypingAcquisition,\n        getGlobalTypingsCacheLocation(),\n        telemetryEnabled,\n        logger);\n    process.on(\"uncaughtException\", function (err: Error) {\n        ioSession.logError(err, \"unknown\");\n    });\n\n    // Generators as methods.\n    class WithAGeneratorFirst {\n        *blah() {\n        }\n    }\n\n    class WithAGeneratorAfterAProperty {\n        public foo: string = \"1\";\n\n        *blah() {\n        }\n    }\n\n    class WithAGeneratorAfterAnotherMethod {\n        foo() {\n        }\n\n        *blah() {\n        }\n    }\n\n    class WithSpaceAfterAsterisk  {\n        bar() {\n        }\n\n        * oops() {\n        }\n    }\n\n\n    class WithSpaceAfterParens  {\n        bar() {\n        }\n\n        *oops () {\n        }\n    }\n\n    class WithArguments  {\n        bar() {\n        }\n\n        *oops(foo: number, bar: string) {\n        }\n    }\n\n    // Some continued expressions\n    {\n        const a = 1 *\n            2 /\n            3 +\n            4 -\n            5 %\n            6;\n\n        const b = 1 >\n            2;\n\n        const c = 1 <\n            2;\n\n        const d = 1 &\n            2 |\n            3;\n\n        const e = b ?\n            2 :\n            3;\n\n        const e2 = b ?\n            { a: 1 } :\n            3;\n\n        const f = window\n            .document;\n\n        const g = f\n            instanceof Object;\n\n        const h = \"q\"\n            in [1, 2];\n\n    }\n\n    {\n        // Object with fields that are keyword names.\n        const a = {\n            in: 1,\n            IN: 1,\n            instanceof: 1,\n            instanceOf: 1,\n        };\n\n        // Objects with methods that are keyword names.  At the top of\n        // the object declaration, and after a function declaration.\n        class One {\n            instanceOf(): void {\n            }\n\n            in(): void {}\n        }\n\n        // After a field declaration.\n        class Two {\n            foo: boolean = true;\n\n            instanceOf(): void {\n            }\n        }\n    }\n\n    // Spread syntax\n    {\n        const a = { a: 1, b: 2 };\n        const b = {\n            ...a,\n            a: 3,\n        };\n        const c = [1, 2];\n        const d = [\n            \"a\",\n            ...c\n        ];\n\n        function foo(a: string,\n                     b: number,\n                     ...rest: any[]) {\n        }\n    }\n\n    {\n        // Regular expressions in lists.\n\n        // List objects...\n        const a = [\n            /abc/,\n            /def/\n        ];\n\n        const z =\n            /abcd/;\n\n        // Argument lists...\n        function foo(a: RegExp, b: RegExp): void {\n        }\n\n        foo(\n            /abc/,\n            /def/);\n    }\n}\n\n// Tests for return value annotations.\n\n// Unannotated.\nfunction moo(x: any,\n             f: string) {\n    return null;\n}\n\n// No parens around return type.\nfunction moo2(x: any,\n              f: string): (a: number) => void {\n    return null;\n}\n\n// Parens around return type.\nfunction foo(x: any,\n             f: string): ((a: number) => void) {\n    return null;\n}\n\nclass Moo {}\n\n// Type guard.\nfunction foo2(x: any,\n              f: string): x is Moo {\n    return x.something === 1;\n}\n\n// Usage of generic in return type.\nfunction foo3(a: number,\n              b: number): Array<Array<(a: number) => void>> {\n    return [];\n}\n\n// Curly brackets in return type.\nfunction bar(a: number,\n             b: number): { z(): string } {\n    return {\n        z() { return \"a\"; }\n    };\n}\n\n// The sequence ): in the return type.\nfunction bif(a: number,\n             b: number): \"abc):d\" {\n    return \"abc):d\";\n}\n\n// Generic and union in return type. This case was constructed from\n// a specific bug in the indentation code.\nfunction bif2(a: number,\n              b: number): Array<number> | number {\n    return 1;\n}\n\n// Array shorthand.\nfunction bif3(a: number,\n              b: number): number[] {\n    return [1];\n}\n\n// Array shorthand in union.\nfunction bif4(a: number,\n              b: number): number[] | number {\n    return [1];\n}\n\n// Array shorthand in union, with spaces.\nfunction bif5(a: number,\n              b: number): number[   ] | number {\n    return [1];\n}\n\n// Comment where the return type would appear.\nfunction gogo(a: number,\n              b: number) /* foo */ {\n}\n\n// Function call in the list of arguments.\nfunction foo5(x: any,\n              f: string = bif(1, 2)): ((a: number) => void) {\n    return null;\n}\n\n// Dotted name in return type.\nfunction foo6(x: any,\n              f: number): ts.server.SomeType {\n    return \"string\";\n}\n\n// First parameter has function signature.\nfunction foo7(x: (a: string, b: string) => Array<number>,\n              b: number): void {\n}\n\n// Second parameter has function signature.\nfunction foo7b(a: string,\n               x: (a: number, b: number) => Array<number>): void {\n}\n\nfunction foo8(): void {\n    // Arrow function in first parameter.\n    foo7((a: string): Array<number> => {\n        return [1];\n    },\n         1);\n\n    // Arrow function in first parameter, line break in parameters.\n    foo7((a: string,\n          b: string): Array<number> => {\n        return [1];\n    },\n         1);\n\n    // Arrow function in second parameter.\n    foo7b(\"1\",\n          (a: number, b: number): Array<number> => {\n              return [1];\n          });\n\n    // Arrow function in second parameter, line break in parameters.\n    foo7b(\"1\",\n          (a: number,\n           b: number): Array<number> => {\n              return [1];\n          });\n}\n\n// Arrow function assignment, line break in parameters.\nconst foo9 = (a: string,\n              b: string): Array<number> => {\n    return [1];\n}\n\n// Arrow function assignment.\nconst foo10 = (a: string, b: string): Array<number> => {\n    return [1];\n}\n\n// Arrow function assignment, parenthesized.\nconst foo11 = ((a: string, b: string): Array<number> => {\n    return [1];\n});\n\nfunction foo12(): void {\n    // Function in first parameter.\n    foo7(function (a: string): Array<number> {\n        return [1];\n    },\n         1);\n\n    // Function in first parameter, line break in parameters.\n    foo7(function (a: string,\n                   b: string): Array<number> {\n        return [1];\n    },\n         1);\n\n    // Arrow function in second parameter.\n    foo7b(\"1\",\n          function (a: number, b: number): Array<number> {\n              return [1];\n          });\n\n    // Arrow function in second parameter, line break in parameters.\n    foo7b(\"1\",\n          function (a: number,\n                    b: number): Array<number> {\n              return [1];\n          });\n\n    // Same cases as above but named.\n\n    // Function in first parameter.\n    foo7(function _mip(a: string): Array<number> {\n        return [1];\n    },\n         1);\n\n    // Function in first parameter, line break in parameters.\n    foo7(function _mip(a: string,\n                       b: string): Array<number> {\n        return [1];\n    },\n         1);\n\n    // Arrow function in second parameter.\n    foo7b(\"1\",\n          function _mip(a: number, b: number): Array<number> {\n              return [1];\n          });\n\n    // Arrow function in second parameter, line break in parameters.\n    foo7b(\"1\",\n          function _mip(a: number,\n                        b: number): Array<number> {\n              return [1];\n          });\n\n    // Same cases as above but generators.\n\n    // Function in first parameter.\n    foo7(function *(a: string): Array<number> {\n        return [1];\n    },\n         1);\n\n    // Function in first parameter, line break in parameters.\n    foo7(function *(a: string,\n                    b: string): Array<number> {\n        return [1];\n    },\n         1);\n\n    // Arrow function in second parameter.\n    foo7b(\"1\",\n          function *(a: number, b: number): Array<number> {\n              return [1];\n          });\n\n    // Arrow function in second parameter, line break in parameters.\n    foo7b(\"1\",\n          function *(a: number,\n                     b: number): Array<number> {\n              return [1];\n          });\n\n    // Check that JavaScript objects are still handled right. Whether\n    // in the 1st or subsequent position of a call.\n    function smurf(a: {}, b: {}) {}\n    smurf({\n        a: {},\n    },\n          {\n        a: {},\n    });\n\n    smurf({\n        a: {},\n    }, {\n        a: {},\n    });\n}\n\n// Number literals in the return type annotation.\nfunction foo13(something: string,\n               somethingElse: string): 0b1 | 0 | -1 | 0o2 | 0x3f {\n    return 0;\n}\n\n// No spaces between numbers and type union symbols. (Also changed the\n// notation to uppercase where possible.)\nfunction foo14(something: string,\n               somethingElse: string): 0B1|0|-1|0O2|0X3F {\n    return 0;\n}\n\nconst a =\n    1; // Blah\nconst b = 2;\n\nfunction blipblop(): void {\n    {\n        const q = 1;\n    }\n}\n\n// The following section deals with distinguishing the purpose of the symbol >\n// when it appears at the end of a line.\n// cf. https://github.com/ananthakumaran/typescript.el/issues/81\n{\n\n    var a, b, c, d, e, f, l, o, t, x, z\n    type z      = {} // Zero argument\n    type o<A>   = {} // One  argument\n    type t<A,B> = {} // Two  arguments\n\n    // greater-than operator\n    x = b >\n        c\n    // looks like a<b,c> but is greater-than operator\n    x = t < z , z >\n        f()\n    // looks almost the same but this time, it's a type\n    type x = t < z , z >\n    f()\n    // looks almost the same but this time, it's a type\n    x = a as t < z , z >\n    f()\n    // tricky, this is greater-than, because \"number\" is a keyword\n    a = b as number < z , z >\n        f()\n\n    // Next one is ambiguous! It could be read as:\n    // (b as t) < z, z > f()\n    // or\n    // b as (t < z , z >) \\n f()\n    // It turns out that when t is not a keyword, TypeScript always chooses the\n    // latter, and complains if you attempted the former\n    a = b as t < z , z >\n    f()\n\n    l = [\n        // operator at end of line\n        a >\n            b,\n        // operator alone on line\n        a\n            >\n            b,\n        // end of 1st line is type argument, 2nd is operator\n        a as b < c , d >\n            >\n            d\n    ]\n\n    // properly-closed parameterized type, followed by operator\n    g = a as o < z > >\n        b\n\n    // Good case\n    class Q<X> {\n        q: string = \"a\"\n    }\n\n    type a<X> =\n        Q<X>\n    const blah = 1\n\n    // Problem cases\n    interface Something {\n        a: string;\n        b: string;\n        c: -5;\n    }\n\n    class Fluff<X extends Something> {\n    }\n\n    // Example of = and - in a type parameter.\n    type c<X extends Something = { a: string; b: string; c: -5; more: string }>\n        = Fluff<X>\n    const moo = 1\n\n    // Example of + in a type parameter.\n    type d<X extends Something = { +readonly [P in keyof Something]: Something[P] }>\n        = Fluff<X>\n    const moo2 = 1\n\n    class Foo {\n        a : O<Z>\n        public readonly a : O<Z>\n        public b : O<Z>\n        private c : O<Z>\n        private d : O<Z>\n    }\n\n    type Foo {\n        readonly a : O<Z>\n        b : O<Z>\n        readonly b : O<Z>\n        c : { }\n        d : O<Z>\n    }\n\n    interface Foo {\n        a : O<Z>\n        b : { }\n    }\n\n    a = a ? a < a : a >\n        a\n\n    a = a ? a : a < a || a >\n        a\n\n    a = a ? a < a : a >\n        a\n    // ^ This test is the same as two above, but a bad guess could answer differently.\n\n    type Foo { }\n    a = a ? a < a : a >\n        a\n\n    class Foo { }\n    a = a ? a < a : a >\n        a\n\n    type A = B<import('../file').T>\n    foo\n\n    type A = import('../file').B<import('../file').C>\n    foo\n\n}\n\ncontainer.each(x => x)\nsomething() // No reason for this to be indented! (cf. issue #83)\n\n// Method calls that look like braceless keywords should not indent!\nfunction test() {\n    return (\n        f.catch()\n    )\n    return (\n        f.do()\n    )\n    return (\n        f.each()\n    )\n    return (\n        f.else()\n    )\n    return (\n        f.if()\n    )\n    return (\n        f.finally()\n    )\n    return (\n        f.then()\n    )\n}\n\n// https://github.com/emacs-typescript/typescript.el/issues/107\nlet $img: JQuery<HTMLImageElement>\nif (variable != null) {\n    //\n}\n\nlet $img2: JQuery<HTMLImageElement> = null\nif (variable != null) {\n    //\n}\n\n// The following block deals with strings of member expressions on so-called\n// \"fluent\" APIs.\ninterface Fnord {\n    log(...args: any[]): this;\n    blah(): this;\n}\n\nlet fnord: Fnord = {} as any;\n\n{\n    fnord\n        .log(\"sdf\")\n        .blah();\n\n    const m =\n        fnord\n            .log()\n            .blah();\n\n    const b = { q: 1, f: 2}\n\n    const x =\n        fnord\n            .log({ a: b.q, z: b.f })\n            .blah();\n\n    (async () => {\n        const x = (\n            await (fnord as any)\n                .log(1));\n    })();\n}\n\nfnord\n    .log(\"sdf\")\n    .blah();\n\nconst m =\n    fnord\n        .log()\n        .blah();\n\nfnord\n    .log(\"sdf\")\n\nconst q =\n    fnord\n        .log();\n\n// This is a continued expression in parentheses.\nconst blip999 = (window.location.href === \"fnord\" ?\n    \"a\" :\n    \"b\");\n\n// The following case is purposely not correct TS code. It tests against an\n// infinite loop that would occur when the mode was asked to indent such\n// incorrect syntax.\nif (true) {\n    .bleh();\n}\n\nconst m =\n    fnord<string, number>()\n        .log<number, string>()\n        .blah();\n\n// This next expression is purposely not correct TS code. The missing parens\n// after fnord would trigger an infinite loop in earlier implementations.\nconst m =\n    fnord<string, unknown>\n        .log<number, string>()\n        .blah();\n\n) {\n    1 + 2; // Indenting this line would cause an infinite loop\n}\n"
  },
  {
    "path": "test-files/list-items-indent-comma-first.ts",
    "content": "const arr =\n    [ 'one'\n    , 'two'\n    , 'three' ];\n\nconst obj =\n    { a: 111\n    , b: 222\n    , c: 333 };\n\nconst depth = { arr: [ 'one'\n                     , 'two'\n                     , 'three' ]\n              , obj: { a: 111\n                     , b: 222\n                     , c: 333 }\n              , func_call: Object.assign\n              ( {}\n              , { x: 1\n                , y: 2\n                , z: 3 }\n              , { i: 'i', j: 'j' } ) };\n"
  },
  {
    "path": "test-files/list-items-indent-default.ts",
    "content": "const arr =\n    [ 'one'\n      , 'two'\n      , 'three' ];\n\nconst obj =\n    { a: 111\n      , b: 222\n      , c: 333 };\n\nconst depth = { arr: [ 'one'\n                       , 'two'\n                       , 'three' ]\n                , obj: { a: 111\n                         , b: 222\n                         , c: 333 }\n                , func_call: Object.assign\n                ( {}\n                  , { x: 1\n                      , y: 2\n                      , z: 3 }\n                  , { i: 'i', j: 'j' } ) };\n"
  },
  {
    "path": "test-files/switch-case-indent-default.ts",
    "content": "function indentTest(): any {\n    const obj = {\n        case: 1,\n        default: 2\n    };\n\n    // This function was specifically added to test for a reversion in\n    // the code that indents switch statements.\n    function turnip(): void {\n    }\n\n    switch (process.platform) {\n        case \"moo\":\n            break;\n        case \"win32\": {\n            const basePath = process.env.LOCALAPPDATA ||\n                process.env.APPDATA;\n            return combinePaths(normalizeSlashes(basePath), \"Microsoft/TypeScript\");\n        }\n        case \"darwin\":\n            const objCase = {\n                case: 1,\n                default: 2\n            };\n        case \"linux\":\n        case \"android\": {\n            const cacheLocation = getNonWindowsCacheLocation(process.platform === \"darwin\");\n            return combinePaths(cacheLocation, \"typescript\");\n        }\n        default:\n            const objDefault = {\n                case: 1,\n                default: 2\n            };\n            Debug.fail(`unsupported platform '${process.platform}'`);\n            return;\n    }\n}\n"
  },
  {
    "path": "test-files/switch-case-indent-disabled.ts",
    "content": "function getGlobalTypingsCacheLocation() {\n    const obj = {\n        case: 1,\n        default: 2\n    };\n    switch (process.platform) {\n    case \"win32\": {\n        const basePath = process.env.LOCALAPPDATA ||\n            process.env.APPDATA;\n        return combinePaths(normalizeSlashes(basePath), \"Microsoft/TypeScript\");\n    }\n    case \"darwin\":\n        const objCase = {\n            case: 1,\n            default: 2\n        };\n    case \"linux\":\n    case \"android\": {\n        const cacheLocation = getNonWindowsCacheLocation(process.platform === \"darwin\");\n        return combinePaths(cacheLocation, \"typescript\");\n    }\n    default:\n        const objDefault = {\n            case: 1,\n            default: 2\n        };\n        Debug.fail(`unsupported platform '${process.platform}'`);\n        return;\n    }\n}\n"
  },
  {
    "path": "typescript-mode-general-tests.el",
    "content": ";;; typescript-mode-general-tests --- This file contains general tests for typescript-mode.el\n\n;;; Commentary:\n;; To know how to run the tests, see typescript-mode-tests.el\n\n;;; Code:\n\n(require 'ert)\n(require 'typescript-mode)\n(require 'cl-lib)\n(require 'typescript-mode-test-utilities)\n\n(defun typescript-test-get-doc ()\n  (buffer-substring-no-properties (point-min) (point-max)))\n\n(defun typescript-test-indent-all ()\n  (delete-trailing-whitespace)\n  (indent-region (point-min) (point-max) nil)\n  (untabify (point-min) (point-max)))\n\n(ert-deftest auto-mode-alist-ts ()\n  (find-file (make-temp-file load-file-name nil \".ts\"))\n  (should (string-equal \"typescript-mode\" major-mode)))\n\n(ert-deftest auto-mode-alist-tsx ()\n  (find-file (make-temp-file load-file-name nil \".tsx\"))\n  (should (string-equal \"typescript-mode\" major-mode)))\n\n(ert-deftest indentation-reference-document-is-reflowed-correctly ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/indentation-reference-document.ts\")\n    ;; double ensure mode is active\n    (typescript-mode)\n\n    (let ((test-reference (typescript-test-get-doc)))\n      (typescript-test-indent-all)\n      (should (string-equal test-reference\n                            (typescript-test-get-doc)))\n      (let ((typescript-indent-switch-clauses nil))\n        (typescript-test-indent-all)\n        (should (string-equal test-reference\n                              (typescript-test-get-doc)))))))\n\n(ert-deftest switch-case-indent-default ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/switch-case-indent-default.ts\")\n    (typescript-mode)\n    (let ((test-reference (typescript-test-get-doc)))\n      (typescript-test-indent-all)\n      (should (string-equal test-reference\n                            (typescript-test-get-doc))))))\n\n(ert-deftest switch-case-indent-disabled ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/switch-case-indent-disabled.ts\")\n    (let ((typescript-indent-switch-clauses nil))\n      (typescript-mode)\n      (let ((test-reference (typescript-test-get-doc)))\n        (typescript-test-indent-all)\n        (should (string-equal test-reference\n                              (typescript-test-get-doc)))))))\n\n(ert-deftest list-items-indent-default ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/list-items-indent-default.ts\")\n    (typescript-mode)\n    (let ((test-reference (typescript-test-get-doc)))\n      (typescript-test-indent-all)\n      (should (string= test-reference (typescript-test-get-doc))))))\n\n(ert-deftest list-items-indent-default-not-comma-first ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/list-items-indent-comma-first.ts\")\n    (typescript-mode)\n    (let ((test-reference (typescript-test-get-doc)))\n      (typescript-test-indent-all)\n      (should-not (string= test-reference (typescript-test-get-doc))))))\n\n(ert-deftest list-items-indent-comma-first ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/list-items-indent-comma-first.ts\")\n    (typescript-mode)\n    (let ((test-reference (typescript-test-get-doc))\n          (typescript-indent-list-items nil))\n      (typescript-test-indent-all)\n      (should (string= test-reference (typescript-test-get-doc))))))\n\n(ert-deftest list-items-indent-comma-first-not-default ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/list-items-indent-default.ts\")\n    (typescript-mode)\n    (let ((test-reference (typescript-test-get-doc))\n          (typescript-indent-list-items nil))\n      (typescript-test-indent-all)\n      (should-not (string= test-reference (typescript-test-get-doc))))))\n\n(defun get-all-matched-strings (to-match)\n  (let (result)\n    (dotimes (x (/ (length (match-data)) 2))\n      (setq result (nconc result (list (match-string x to-match)))))\n    result))\n\n(ert-deftest typescript-tslint-report-regexp-matches ()\n  \"typescript-tslint-report-regexp matches a line that does not\nhave a rule name or a severity.\"\n  (let* ((to-match\n          \"src/modules/authenticator.ts[1, 83]: ' should be \\\"\")\n         (match (string-match typescript-tslint-report-regexp\n                              to-match))\n         (matches (and match (get-all-matched-strings to-match))))\n    (should match)\n    (should-not (nth 1 matches))\n    (should-not (nth 2 matches))\n    (should (string-equal (nth 3 matches)\n                          \"src/modules/authenticator.ts\"))\n    (should (string-equal (nth 4 matches) \"1\"))\n    (should (string-equal (nth 5 matches) \"83\"))))\n\n(ert-deftest typescript-tslint-report-regexp-matches-with-name ()\n  \"typescript-tslint-report-regexp matches a line that has\na rule name, no severity.\"\n  (let* ((to-match\n          \"(quotemark) src/modules/authenticator.ts[1, 83]: ' should be \\\"\")\n         (match (string-match typescript-tslint-report-regexp\n                              to-match))\n         (matches (and match (get-all-matched-strings to-match))))\n    (should match)\n    (should-not (nth 1 matches))\n    (should (string-equal (nth 2 matches) \"(quotemark) \"))\n    (should (string-equal (nth 3 matches)\n                          \"src/modules/authenticator.ts\"))\n    (should (string-equal (nth 4 matches) \"1\"))\n    (should (string-equal (nth 5 matches) \"83\"))))\n\n(ert-deftest typescript-tslint-report-regexp-matches-with-error ()\n  \"typescript-tslint-report-regexp matches a line that has\na severity set to ERROR, no rule name.\"\n  (let* ((to-match\n          \"ERROR: src/modules/authenticator.ts[1, 83]: ' should be \\\"\")\n         (match (string-match typescript-tslint-report-regexp\n                              to-match))\n         (matches (and match (get-all-matched-strings to-match))))\n    (should match)\n    (should-not (nth 1 matches))\n    (should-not (nth 2 matches))\n    (should (string-equal (nth 3 matches)\n                          \"src/modules/authenticator.ts\"))\n    (should (string-equal (nth 4 matches) \"1\"))\n    (should (string-equal (nth 5 matches) \"83\"))))\n\n(ert-deftest typescript-tslint-report-regexp-matches-with-warning ()\n  \"typescript-tslint-report-regexp matches a line that has\na severity set to WARNING, no rule name.\"\n  (let* ((to-match\n          \"WARNING: src/modules/authenticator.ts[1, 83]: ' should be \\\"\")\n         (match (string-match typescript-tslint-report-regexp\n                              to-match))\n         (matches (and match (get-all-matched-strings to-match))))\n    (should match)\n    (should (string-equal (nth 1 matches) \"WARNING\"))\n    (should-not (nth 2 matches))\n    (should (string-equal (nth 3 matches)\n                          \"src/modules/authenticator.ts\"))\n    (should (string-equal (nth 4 matches) \"1\"))\n    (should (string-equal (nth 5 matches) \"83\"))))\n\n(ert-deftest typescript--number-literal-re-matches-numbers ()\n  \"`typescript--number-literal-re' matches numbers.\"\n  (dolist (to-match '(\"NaN\" \"Infinity\" \"-Infinity\" \"-1\" \"1\" \"0.1\" \".1\" \"-.1\" \"8e23\"\n                      \"9E-2\" \".1e23\" \"0b1\" \"-0B1\" \"0o7\" \"-0O13\" \"0xaf\" \"-0XAF\"))\n    (should (string-match typescript--number-literal-re to-match))\n    ;; The regular expression does not begin with ^ and end with $ so\n    ;; we need to check ourselves that the whole string is matched.\n    (should (string-equal (match-string 0 to-match) to-match))))\n\n(ert-deftest typescript--number-literal-re-does-not-match-non-numbers ()\n  \"`typescript--number-literal-re' does not match non-numbers.\"\n  (dolist (to-match '(\"NaNa\" \"Inf\" \"1.\" \".\" \"0xPQ\" \"e\" \"2.3e2.4\"))\n    ;; For the same reason as for the positive test above, what we want is either no match\n    ;; or a match that fails to match the whole string.\n    (should-not (and (string-match typescript--number-literal-re to-match)\n                     (string-equal (match-string 0 to-match) to-match)))))\n\n(ert-deftest correctly-indents-lines-with-wide-chars ()\n  \"Otsuka Ai and other multi-char users should be a happy to write typescript.\"\n\n  (with-temp-buffer\n    (ignore-errors (typescript-mode))\n    (insert \"let x = '大塚愛'\")\n    (let ((pos1 (current-column)))\n      (typescript-indent-line)\n      (let ((pos2 (current-column)))\n        (should (= pos1 pos2))))))\n\n(ert-deftest correctly-indents-lines-with-tabs ()\n  (with-temp-buffer\n    (ignore-errors (typescript-mode))\n\n    (insert \"class Example {\")\n    (newline-and-indent)\n    (insert \"constructor() {\")\n    (newline-and-indent)\n    (insert \"const a = new Promise\")\n\n    (should (= 29 (current-column)))\n    (typescript-indent-line)\n    (should (= 29 (current-column)))\n\n    ;; verify tab was used\n    (move-beginning-of-line nil)\n    (should (= 0 (current-column)))\n    (forward-char 1)\n    (should (= 8 (current-column)))))\n\n(ert-deftest correctly-indents-dot-dot-after-exclamation ()\n  (with-temp-buffer\n    (ignore-errors (typescript-mode))\n    (insert \"situation('8/8/8/8/8/8/8/R3K2R w - - 0 1')?.\")\n    (forward-char -1)\n    (newline-and-indent)\n    (should (= 4 (current-column)))))\n\n(ert-deftest indentation-does-not-hang-on-multiline-string ()\n  \"Testcase for https://github.com/ananthakumaran/typescript.el/issues/20\"\n\n  (with-temp-buffer\n    (typescript-mode)\n\n    (insert \"let multiLineString = \\\"line 1\")\n    (newline-and-indent)\n    (insert \"// and so we continue\")\n    (newline-and-indent)\n    ;; completing and not locking up is test-success!\n    ))\n\n(ert-deftest typescript--forward-expression-on-multiline-indented-string ()\n  \"Testcase for https://github.com/emacs-typescript/typescript.el/issues/105\"\n\n  (with-temp-buffer\n    (typescript-mode)\n\n    (insert\n\"fetch('http://localhost:8529/_db/_system/land', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json',\n    Accept: 'application/json',\n  },\n  body: JSON.stringify({\n    query: `{\n      query GetElement {\n        element(id: \\\"0000\\\") {\n          collection\n          id\n          name\n          description\n        }\n      }\n    }`,\n  }),\n})\n  .then(r => r.json())\n  .then(data => console.log('data returned:', data));\")\n\n    (goto-char (point-min))\n    (typescript--forward-expression)\n    ;; completing and not locking up is test-success!\n    ;; Should there be a time-out? Or it is handled by external tool?\n\n    ;; Check that `typescript--forward-expression' jumped to the right position.\n    (should (= 434 (point)))))\n\n(defun test-re-search (searchee contents offset)\n  (with-temp-buffer\n    (typescript-mode)\n\n    (insert contents)\n    (goto-char (- (point-max) offset))\n\n    (should (= 5 (typescript--re-search-backward-inner searchee nil 1)))))\n\n(ert-deftest re-search-backwards-skips-single-line-strings ()\n  (test-re-search \"token\" \"let token = \\\"token in string-thing\\\";\" 2))\n\n(ert-deftest re-search-backwards-skips-multi-line-strings ()\n  (test-re-search \"token\" \"let token = \\\"token in\\n multi-line token string\\\";\" 2))\n\n(ert-deftest re-search-backwards-skips-single-line-comments ()\n  (test-re-search \"token\" \"let token; // token in comment\" 0))\n\n(ert-deftest re-search-backwards-skips-multi-line-comments ()\n  (test-re-search \"token\" \"let token; /* token in \\nmulti-line token comment\" 0))\n\n(setq font-lock-contents\n \" * @param {Something} bar A parameter. References [[moo]] and [[foo]].\n * @param second May hold ``x`` or ``y``.\")\n\n(ert-deftest font-lock/interface-builtin-key-context-unfontify ()\n  \"Builtins should not be fontified when they are in object or\ninterface key context.\"\n  (test-with-fontified-buffer\n      \"interface Foo { type: number; unknown: string; foo: boolean }\"\n    (should (eq (get-face-at \"type\") 'default))\n    (should (eq (get-face-at \"unknown\") 'default)))\n\n  (test-with-fontified-buffer\n      \"const x = { type: 4; unknown: 'bar'; foo: true }\"\n    (should (eq (get-face-at \"type\") 'default))\n    (should (eq (get-face-at \"unknown\") 'default))))\n\n(ert-deftest font-lock/documentation-in-documentation-comments ()\n  \"Documentation in documentation comments should be fontified as\ndocumentation.\"\n  (font-lock-test\n   (concat \"/**\\n\" font-lock-contents \"\\n*/\")\n   '((1 . font-lock-comment-delimiter-face)\n     (5 . font-lock-comment-face)\n     (\"@param\" . typescript-jsdoc-tag)\n     (\"{Something}\" . typescript-jsdoc-type)\n     (\"bar\" . typescript-jsdoc-value)\n     (\"\\\\[\\\\[moo\\\\]\\\\]\" . typescript-jsdoc-value)\n     (\"\\\\[\\\\[foo\\\\]\\\\]\" . typescript-jsdoc-value)\n     (\"``x``\" . typescript-jsdoc-value)\n     (\"``y``\" . typescript-jsdoc-value))))\n\n(ert-deftest font-lock/no-documentation-in-non-documentation-comments ()\n  \"Documentation tags that are not in documentation comments\nshould not be fontified as documentation.\"\n  (test-with-fontified-buffer\n   (concat \"/*\\n\" font-lock-contents \"\\n*/\\n\")\n   (let ((loc 3))\n     ;; Make sure we start with the right face.\n     (should (eq (get-face-at loc) font-lock-comment-face))\n     (should (eq (text-property-not-all loc (point-max) 'face font-lock-comment-face)\n                 (1- (point-max)))))))\n\n(ert-deftest font-lock/no-documentation-in-strings ()\n  \"Documentation tags that are not in strings should not be\nfontified as documentation.\"\n  (test-with-fontified-buffer\n   (concat \"const x = \\\"/**\" font-lock-contents \"*/\\\";\")\n   (let ((loc (search-forward \"\\\"\")))\n     ;; Make sure we start with the right face.\n     (should (eq (get-face-at loc) font-lock-string-face))\n     ;; Make sure the face does not change later.\n     (should (eq (text-property-not-all loc (point-max) 'face font-lock-string-face)\n                 (1- (point-max)))))))\n\n(ert-deftest font-lock/immediate-doc ()\n  \"Tests that it is not necessary to have the documentation tag on a\nnew line after the start of '/**'.\"\n  (font-lock-test\n   ;; We have 4 comments here because we need to cover the multiple\n   ;; regexes that deal with the different types of jsdoc tags.\n   \"/** @type {foo} */\\n\n/** @alias bar */\\n\n/** @author me */\\n\n/** @param meow */\"\n   '((1 . font-lock-comment-delimiter-face)\n     (\"@type\" . typescript-jsdoc-tag)\n     (\"{foo}\" . typescript-jsdoc-type)\n     (\"@alias\" . typescript-jsdoc-tag)\n     (\"bar\" . typescript-jsdoc-value)\n     (\"@author\" . typescript-jsdoc-tag)\n     (\"me\" . font-lock-comment-face)\n     (\"@param\" . typescript-jsdoc-tag)\n     (\"meow\" . typescript-jsdoc-value))))\n\n(ert-deftest font-lock/function-definition-prefixes ()\n  \"Tests that function names are highlighted in definitions, even\nwhen prefixed with module modifiers.\"\n  (font-lock-test\n   \"function basicDefn(x0: xty0, y0: yty0): ret0 {}\\n\nexport function exportedDefn(x1: xty1, y1: yty1): ret1 {}\\n\nexport default function exportedDefaultDefn(x2: xty2, y2: yty2): ret2 {}\\n\ndeclare function declareFunctionDefn(x3: xty3, y3: yty3): ret3;\"\n    '((\"basicDefn\" . font-lock-function-name-face)\n      (\"exportedDefn\" . font-lock-function-name-face)\n      (\"exportedDefaultDefn\" . font-lock-function-name-face)\n      (\"declareFunctionDefn\" . font-lock-function-name-face)\n      ((\"x0\" \"x1\" \"x2\" \"x3\") . font-lock-variable-name-face)\n      ((\"\\\\by0\" \"\\\\by1\" \"\\\\by2\" \"\\\\by3\") . font-lock-variable-name-face)\n      ((\"ret0\" \"ret1\" \"ret2\" \"ret3\") . nil))))\n\n(ert-deftest font-lock/level-four ()\n  \"Tests the level four font lock highlights.\"\n  (font-lock-test\n   \"@decorator\\n\nclass Foo<T> extends Bar {\\n\nprivate async innerExecuteAsync<TResponse extends Response, TValue>(endpoint: string, data?: any): Promise<TResponse> {\\n\ninnerExecuteAsync(x: string, y: boolean, z: number, j?: any): Promise<FResponse> {\\n\nconsole.log(this.methodCall());\\n\nsnake_cased_function(1, 2, 3)\"\n    '((\"@decorator\" . font-lock-function-call-face)\n      (\"Foo\" . font-lock-type-face)\n      (\"private\" . typescript-access-modifier-face)\n      (\"innerExecuteAsync\" . font-lock-function-name-face)\n      ((\"TResponse\" \"FResponse\" \"Response\" \"TValue\") . font-lock-type-face)\n      (\"console\" . font-lock-type-face)\n      (\"this\" . typescript-this-face)\n      (\"methodCall\" . font-lock-function-call-face)\n      (\"snake_cased_function\" . font-lock-function-call-face)\n      ((\"string\" \"boolean\" \"number\" \"any\") . typescript-primitive-face)\n      ((\"endpoint\" \"data\") . font-lock-variable-name-face)\n      ((\"<\" \">\" \",\") . nil))))\n\n(ert-deftest font-lock/method-call-with-keyword-name ()\n  \"If the name of the method is a keyword, it should still be highlighted as function.\"\n  (test-with-fontified-buffer\n      \"const app = express();\napp.get()\napp.post()\napp.delete()\nif (true) {}\n// for (abc) {}\"\n    (should (eq (get-face-at \"get\") 'font-lock-function-call-face))\n    (should (eq (get-face-at \"post\") 'font-lock-function-call-face))\n    (should (eq (get-face-at \"delete\") 'font-lock-function-call-face))\n    (should (eq (get-face-at \"if\") 'font-lock-keyword-face))\n    (should (eq (get-face-at \"for\") 'font-lock-comment-face))))\n\n(ert-deftest font-lock/generics ()\n  \"Tests that type hints within generics are highlighted properly.\"\n  (font-lock-test\n   \"const map = new Map<string, number>()\\n\nfunction foo<Z, Y, Z & Y, Z | Y | Z, Y<X<X, Y>>>()\\n\"\n   '(((\"string\" \"number\") . typescript-primitive-face)\n      (\"foo\" . font-lock-function-name-face)\n      ((\"Z\" \"Y\" \"X\") . font-lock-type-face)\n      ((\"<\" \">\" \",\" \"&\" \"|\") . nil))))\n\n(ert-deftest font-lock/tsx ()\n  \"Tests that tsx blocks are not considered generics by virtue of the <.\"\n  (font-lock-test\n   \"<div>test</div>\"\n   '(((\"div\" . nil)))))\n\n(ert-deftest font-lock/regexp ()\n  \"Regular expressions should be fontified as string constant.\"\n  (let ((content \"=/foo/ (/bar/ ,/baz/ :/buzz/\"))\n    (font-lock-test content\n                    '((\"=\" . nil) (\"/foo/\" . font-lock-string-face)\n                      (\"(\" . nil) (\"/bar/\" . font-lock-string-face)\n                      (\",\" . nil) (\"/baz/\" . font-lock-string-face)\n                      (\":\" . nil) (\"/buzz/\" . font-lock-string-face))))\n  ;; Make sure that escaped forward slashes are handled too.\n  (font-lock-test \"var a = /flip\\\\/flop/;\"\n                  '((\"=\" . nil)\n                    ((\"/flip\" \"\\\\\\\\\" \"/\" \"flop/\") . font-lock-string-face)\n                    (\";\" . nil)))\n  ;; Make sure a forward slash in a character class is handled fine.\n  ;; It must not terminate the regular expression.\n  (font-lock-test \"var a = /[/]/;\"\n                  '((\"=\" . nil)\n                    ((\"/\" \"\\\\[/\" \"\\\\]/\") . font-lock-string-face)\n                    (\";\" . nil)))\n  ;; Make sure an open bracket in a character class does not\n  ;; throw off fontification.\n  (font-lock-test \"var a = /[[]/;\"\n                  '((\"=\" . nil)\n                    ((\"/\" \"\\\\[\\\\[\\\\]\" \"/\") . font-lock-string-face)\n                    (\";\" . nil)))\n  ;; A sequence of two forward slashes is never a regex, so there is\n  ;; no such thing as an \\\"empty regex\\\" when we use the forward slash\n  ;; notation.\n  (font-lock-test \"=//g something // comment\"\n                  '((\"g something\" . font-lock-comment-face))))\n\n(ert-deftest font-lock/yield ()\n  \"`yield' and `yield*' should be fontified as keywords.\"\n  (font-lock-test\n   \"function* gen(x0: xty0, y0: yty0): ret0 {\n    yield 123;\n    yield* subIter;\n}\"\n   '((\"yield 123\" . font-lock-keyword-face)\n     (\"yield\\\\*\" . font-lock-keyword-face)\n     (\"\\\\* subIter\" . font-lock-keyword-face))))\n\n(ert-deftest font-lock/yielder ()\n  \"`yielder' should not be fontified as a keyword.\"\n  (font-lock-test\n   \"function* gen(x0: xty0, y0: yty0): ret0 {\n    const yielder = 123;\n    yield abc;\n    return yielder;\n}\"\n   '((\"yielder =\" . font-lock-variable-name-face)\n     (\"yielder;\" . nil))))\n\n(ert-deftest font-lock/text-after-trailing-regexp-delim-should-not-be-fontified ()\n  \"Text after trailing regular expression delimiter should not be fontified.\"\n  (test-with-fontified-buffer\n   \"=/foo/g something // comment\"\n   (should (eq (get-face-at \"g something\") nil)))\n  (test-with-fontified-buffer\n   \"=/foo\\\\bar/g something // comment\"\n   (should (eq (get-face-at \"g something\") nil)))\n  (test-with-fontified-buffer\n   \"=/foo\\\\\\\\bar/g something // comment\"\n   (should (eq (get-face-at \"g something\") nil)))\n  (test-with-fontified-buffer\n   \"=/foo\\\\\\\\/g something // comment\"\n   (should (eq (get-face-at \"g something\") nil))))\n\n(ert-deftest font-lock/type-names ()\n  \"Type names should be highlighted in definitions.\"\n  ;; Typical case.\n  (test-with-fontified-buffer\n      \"export class Foo extends Bar implements Qux {}\"\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Bar\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Qux\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"export class Foo extends Bar implements Qux, Ajx {}\"\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Bar\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Qux\") 'font-lock-type-face))\n    (should (eq (get-face-at \",\") 'nil))\n    (should (eq (get-face-at \"Ajx\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"export class Foo extends Bar implements Qux, Ajx, Psd {}\"\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Bar\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Qux\") 'font-lock-type-face))\n    (should (eq (get-face-at \",\") 'nil))\n    (should (eq (get-face-at \"Ajx\") 'font-lock-type-face))\n    (should (eq (get-face-at \",\") 'nil))\n    (should (eq (get-face-at \"Psd\") 'font-lock-type-face)))\n  ;; Ensure we require symbol boundaries.\n  (test-with-fontified-buffer\n      \"Notclass Foo\"\n    (should-not (eq (get-face-at \"Foo\") 'font-lock-type-face)))\n  ;; Other common ways of defining types.\n  (test-with-fontified-buffer\n      \"interface Thing {}\"\n    (should (eq (get-face-at \"Thing\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"enum Thing {}\"\n    (should (eq (get-face-at \"Thing\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"type Thing = number;\"\n    (should (eq (get-face-at \"Thing\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/fontify-type-guard ()\n  \"The type guard syntax\n\n    var is Type\n\nshould be fontified as variable, keyword and type.\"\n  (test-with-fontified-buffer\n      \"function test(var: unknown): var is RetType {\\n}\"\n    (should (eq (get-face-at 30) 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"is\") 'font-lock-keyword-face))\n    (should (eq (get-face-at \"RetType\") 'font-lock-type-face))))\n\n\n(ert-deftest font-lock/type-names-level4 ()\n  \"Typenames should be highlighted in declarations\"\n\n  (test-with-fontified-buffer\n      \"function test(var1: Type1, var2: Type2): RetType {\\n}\"\n    (should-not (eq (get-face-at \"var1\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Type1\") 'font-lock-type-face))\n    (should-not (eq (get-face-at \"var2\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Type2\") 'font-lock-type-face))\n    (should (eq (get-face-at \"RetType\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"class foo { test(var1: Type1, var2: Type2): RetType {\\n} }\"\n    (should-not (eq (get-face-at \"var1\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Type1\") 'font-lock-type-face))\n    (should-not (eq (get-face-at \"var2\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Type2\") 'font-lock-type-face))\n    (should (eq (get-face-at \"RetType\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"let a: SomeType;\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"private b: SomeType;\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"private someArray: SomeType[];\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"private generic: SomeType<Foo>;\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"private genericArray: SomeType<Foo>[];\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"private genericArray2: SomeType<Foo[]>;\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"private genericArray3: SomeType<Foo[]>[];\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"const f: () => SomeType = () => {}\"\n    (should (eq (get-face-at \"SomeType\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/type-names-level4-namespaces ()\n  \"Namespaced Typenames should be highlighted in declarations\"\n  (test-with-fontified-buffer\n      \"private b: Namespaced.ClassName;\"\n    (should (eq (get-face-at \"Namespaced\") 'font-lock-type-face))\n    (should (eq (get-face-at \"ClassName\") 'font-lock-type-face)))\n  (test-with-fontified-buffer\n      \"function test(var1: Namespaced.ClassName): RetType {\\n}\"\n    (should (eq (get-face-at \"Namespaced\") 'font-lock-type-face))\n    (should (eq (get-face-at \"ClassName\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"class Foo { test(var1: Namespaced.ClassName): RetType {\\n}\"\n    (should (eq (get-face-at \"Namespaced\") 'font-lock-type-face))\n    (should (eq (get-face-at \"ClassName\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"function test(var1: Type): Namespaced.ClassName {\\n}\"\n    (should (eq (get-face-at \"Namespaced\") 'font-lock-type-face))\n    (should (eq (get-face-at \"ClassName\") 'font-lock-type-face)))\n\n  (test-with-fontified-buffer\n      \"class Foo { test(var1: Type): Namespaced.ClassName {\\n}\"\n    (should (eq (get-face-at \"Namespaced\") 'font-lock-type-face))\n    (should (eq (get-face-at \"ClassName\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/funargs--function--multiline-with-types ()\n  \"Variables should be highlighted in multiline declarations with types.\"\n  (test-with-fontified-buffer\n      \"function test(\nvar1: Promise<U1, V1>,\nvar2: (xxx: Foo) => Bar,\nvar3: Type3,\n): RetType {\\n}\"\n    (should (eq (get-face-at \"var1\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"var2\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"var3\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"xxx\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"Promise\") 'font-lock-type-face))\n    (should (eq (get-face-at \"U1\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Type3\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/funargs--function--multiline-without-types ()\n  \"Variables should be highlighted in multiline declarations without types.\"\n  (test-with-fontified-buffer\n      \"function test(\nvar1,\nvar2,\n): RetType {\\n}\"\n    (should (eq (get-face-at \"var1\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"var2\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--function--multiline-hanging-paren ()\n  \"Variables should be highlighted in multiline declarations with hanging paren.\"\n  (test-with-fontified-buffer\n   \"function test(\nvar1,\nvar2): RetType {\\n}\"\n   (should (eq (get-face-at \"var1\") 'font-lock-variable-name-face))\n   (should (eq (get-face-at \"var2\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--function--multiline-ending-comma-hanging-paren ()\n  \"Variables should be highlighted in multiline declarations with hanging paren and trailing comma.\"\n  (test-with-fontified-buffer\n   \"function test(\nvar1,\nvar2,): RetType {\\n}\"\n   (should (eq (get-face-at \"var1\") 'font-lock-variable-name-face))\n   (should (eq (get-face-at \"var2\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--function--singleline-ending-comma-no-hanging-paren ()\n  \"Variables should be highlighted in singleline declarations with no hanging paren and trailing comma.\"\n  (test-with-fontified-buffer\n      \"function test(var1,var2,\n): RetType {\\n}\"\n   (should (eq (get-face-at \"var1\") 'font-lock-variable-name-face))\n   (should (eq (get-face-at \"var2\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--function--singleline-with-types ()\n  \"Variables should be highlighted in singleline declarations with types.\"\n  (test-with-fontified-buffer\n      \"function test(var1: Foo, var2: Bar,): RetType {\\n}\"\n   (should (eq (get-face-at \"var1\") 'font-lock-variable-name-face))\n   (should (eq (get-face-at \"var2\") 'font-lock-variable-name-face))\n   (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n   (should (eq (get-face-at \"Bar\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/funargs--function--singleline-ending-comma-hanging-paren ()\n  \"Variables should be highlighted in singleline declarations with hanging paren and trailing comma.\"\n  (test-with-fontified-buffer\n   \"function test(var1,var2,): RetType {\\n}\"\n   (should (eq (get-face-at \"var1\") 'font-lock-variable-name-face))\n   (should (eq (get-face-at \"var2\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--function--keywords-as-variables ()\n  \"Keywords when used as variables should have variable face\"\n  (test-with-fontified-buffer\n      \"function test(type, unknown): void {}\"\n    (should (eq (get-face-at \"type\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"unknown\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--keywords-as-variables ()\n  \"Keywords when used as variables should have variable face\"\n  (test-with-fontified-buffer\n      \"const test = (type, unknown): void => {}\"\n    (should (eq (get-face-at \"type\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"unknown\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--single-line--no-type ()\n  (test-with-fontified-buffer\n      \"const test = (aaa, bbb, ccc): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--single-line--no-type--no-return-type ()\n  (test-with-fontified-buffer\n      \"const test = (aaa, bbb, ccc) => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--single-line--no-type--trailing-comma ()\n  (test-with-fontified-buffer\n      \"const test = (aaa, bbb, ccc,): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--single-line--no-type--optional ()\n  (test-with-fontified-buffer\n      \"const test = (aaa, bbb?): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb?\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--multiline--no-type ()\n  (test-with-fontified-buffer\n      \"const test = (aaa, bbb,\nccc, ddd): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ddd\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--multiline--no-type--newline-after-last ()\n  (test-with-fontified-buffer\n      \"const test = (aaa, bbb,\nccc, ddd\n): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ddd\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--multiline--no-type--newline-before-first ()\n  (test-with-fontified-buffer\n      \"const test = (\naaa, bbb,\nccc, ddd\n): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ddd\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--multiline--no-type--with-comment ()\n  (test-with-fontified-buffer\n      \"const test = (\naaa, bbb, // comment\nccc, ddd  // comment\n): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ddd\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--single--mixed-type--newline-before-first ()\n  (test-with-fontified-buffer\n      \"const test = (aaa, bbb: Promise, ccc: number, ddd): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ccc\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"ddd\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"Promise\") 'font-lock-type-face))\n    (should (eq (get-face-at \"number\") 'typescript-primitive-face))))\n\n(ert-deftest font-lock/funargs--arrow--single--with-type--complex-type ()\n  (test-with-fontified-buffer\n      \"const test = (aaa: Promise<U, V, (xxx: A) => Foo>, bbb): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"xxx\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--arrow--multiline--with-type--newline-before-first-after-last ()\n  (test-with-fontified-buffer\n      \"const test = (\naaa: Foo,\nbbb: Bar\n): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Bar\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/funargs--arrow--multiline--with-type--newline-before-first-after-last--hanging-comma ()\n  (test-with-fontified-buffer\n      \"const test = (\naaa: Foo,\nbbb: Bar,\n): void => {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Bar\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/backticks--expr-fontification--with-variable ()\n  (test-with-fontified-buffer\n      \"const x = `hello ${world}`\"\n    (should (eq (get-face-at \"${\") 'font-lock-keyword-face))\n    (should (eq (get-face-at \"world\") 'default))\n    (should (eq (get-face-at \"}\") 'font-lock-keyword-face))))\n\n(ert-deftest font-lock/backticks--expr-fontification--not-in-regular-string ()\n  (test-with-fontified-buffer\n      \"const x = 'hello ${world}'\"\n    (should (eq (get-face-at \"${\") 'font-lock-string-face))\n    (should (eq (get-face-at \"world\") 'font-lock-string-face))\n    (should (eq (get-face-at \"}\") 'font-lock-string-face))))\n\n(ert-deftest font-lock/backticks--expr-fontification--with-funcall ()\n  \"For now function calls or any other expressions are fontified as\nif a simple variable token in its entirety.  When/if this is\nimplemented better, this test should be adjusted to capture the\nnew functionality.\"\n  (test-with-fontified-buffer\n      \"const x = `hello ${parseInt(foobar)}`\"\n    (should (eq (get-face-at \"${\") 'font-lock-keyword-face))\n    (should (eq (get-face-at \"parseInt(foobar)\") 'default))\n    (should (eq (get-face-at \"}\") 'font-lock-keyword-face))))\n\n(ert-deftest font-lock/funargs--method--multiline--with-type ()\n  (test-with-fontified-buffer\n      \"class Foo { foo(\naaa: Foo,\nbbb: Bar,\n): void {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Bar\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/funargs--method--single-line--with-type ()\n  (test-with-fontified-buffer\n      \"class Foo { foom(aaa: Foo,bbb: Bar,): void {}\"\n    (should (eq (get-face-at \"foom\") 'font-lock-function-name-face))\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"Foo\") 'font-lock-type-face))\n    (should (eq (get-face-at \"Bar\") 'font-lock-type-face))))\n\n(ert-deftest font-lock/funargs--method--single-line--no-type ()\n  (test-with-fontified-buffer\n      \"class Foo { foo(aaa, bbb): void {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--method--single-line--no-return-type ()\n  (test-with-fontified-buffer\n      \"class Foo { foo(aaa, bbb) {}\"\n    (should (eq (get-face-at \"aaa\") 'font-lock-variable-name-face))\n    (should (eq (get-face-at \"bbb\") 'font-lock-variable-name-face))))\n\n(ert-deftest font-lock/funargs--method--no-fontification-in-ternary ()\n  \"Do not apply fontification on a function call inside a ternary\noperator, which might look like method with return type\ndeclaration.\"\n  (test-with-fontified-buffer\n      \"true ? funcall(helloWorld) : false\"\n    (should (eq (get-face-at \"helloWorld\") nil))))\n\n(ert-deftest font-lock/funargs--method--no-fontification-in-special-form ()\n  \"Do not apply fontification inside a special form paren-form,\nsuch as inside of if/while/switch etc.  These look like method\ndeclarations without a return type annotation but are not.\"\n  (test-with-fontified-buffer\n      \"if (hello && world) { }\"\n    (should (eq (get-face-at \"world\") nil))))\n\n(defun flyspell-predicate-test (search-for)\n  \"This function runs a test on\n`typescript--flyspell-mode-predicate'.  `SEARCH-FOR' is a string\nto search for in the current buffer before running\n`typescript--flyspell-mode-predicate'.  This test checks that the\npoint has not moved.  It returns the value of returned by the\ninvocation of `typescript--flyspell-mode-predicate'.\"\n  (search-forward search-for)\n  (let ((point-before (point)))\n    (prog1\n        (typescript--flyspell-mode-predicate)\n      ;; We should not have moved.\n      (should (eq (point) point-before)))\n  ))\n\n(ert-deftest flyspell-mode-predicate-skips-what-it-should ()\n  \"Check that the custom flyspell predicate filters strings in\nimport... from....\"\n  (let (flyspell-generic-progmode-verify)\n    (fset 'flyspell-generic-progmode-verify (lambda () t))\n    ;; In the following searches we search for the starting quote of the strings\n    ;; to avoid hitting keywords. Moreover, the end position of the search is important.\n    ;; Flyspell puts point at the end of the word before calling the predicate. We must\n    ;; replicate that behavior here.\n    (test-with-fontified-buffer\n     \"import 'a';\\nimport { x } from 'b';\\nconst foo = 'c';import { x }\\nfrom 'd';\"\n     (should-not (flyspell-predicate-test \"'a\"))\n     (should-not (flyspell-predicate-test \"'b\"))\n     (should (flyspell-predicate-test \"'c\"))\n     (should-not (flyspell-predicate-test \"'d\")))\n    (test-with-fontified-buffer\n     ;; This is valid TypeScript.\n     \"const from = 'a';\"\n     (should (flyspell-predicate-test \"'a\")))\n    (test-with-fontified-buffer\n     ;; TypeScript does not allow a function named \"import\" but object\n     ;; members may be named \"import\". So this *can* be valid\n     ;; TypeScript.\n     \"x.import('a');\"\n     (should (flyspell-predicate-test \"'a\")))))\n\n\n(ert-deftest typescript--move-to-end-of-plain-string ()\n  \"Unit tests for `typescript--move-to-end-of-plain-string'.\"\n  (cl-flet\n      ((should-fail ()\n                    (let ((point-before (point)))\n                      (should-not (typescript--move-to-end-of-plain-string))\n                      (should (eq (point) point-before))))\n       (should-not-fail (expected)\n                        (let ((result (typescript--move-to-end-of-plain-string)))\n                          (should (eq result expected))\n                          (should (eq (point) expected)))))\n    ;;\n    ;; The tests below are structured as follows. For each case:\n    ;;\n    ;; 1. Move point to a new location in the buffer.\n    ;;\n    ;; 2. Check whether typescript--move-to-end-of-plain-string returns the value we expected\n    ;;    and changes (point) when successful.\n    ;;\n    ;; Cases often start with a check right away: (point) equal to\n    ;; (point-min) for those cases.\n    ;;\n    (dolist (delimiter '(\"'\" \"\\\"\"))\n      (test-with-temp-buffer\n       (replace-regexp-in-string \"'\" delimiter \"const a = 'not terminated\")\n       (should-fail)\n       (re-search-forward delimiter)\n       (should-fail))\n      (test-with-temp-buffer\n       (replace-regexp-in-string \"'\" delimiter \"const a = 'terminated'\")\n       (should-fail)\n       ;; This checks that the function works when invoked on the start delimiter of\n       ;; a terminated string.\n       (re-search-forward delimiter)\n       (should-not-fail (1- (point-max)))\n       (goto-char (point-min))\n       (re-search-forward \"term\")\n       (should-not-fail (1- (point-max)))\n       ;; This checks that the function works when invoked on the end delimiter of\n       ;; a terminated string.\n       (goto-char (1- (point-max)))\n       (should-not-fail (1- (point-max))))\n      (test-with-temp-buffer\n       (replace-regexp-in-string \"'\" delimiter \"const a = 'terminated aaa';\\n\nconst b = 'not terminated bbb\")\n       (should-fail)\n       (re-search-forward \"term\")\n       (should-not-fail (save-excursion (re-search-forward \"aaa\")))\n       (re-search-forward \"const b\")\n       (should-fail)\n       (re-search-forward \"not terminated\")\n       (should-fail))\n      ;; Case with escaped delimiter.\n      (test-with-temp-buffer\n       (replace-regexp-in-string \"'\" delimiter \"const a = 'terminat\\\\'ed aaa';\\n\n const b = 'not terminated bbb\")\n       (re-search-forward \"term\")\n       (should-not-fail (save-excursion (re-search-forward \"aaa\"))))\n      ;; Delimiters in comments.\n      (test-with-temp-buffer\n       (replace-regexp-in-string \"'\" delimiter \"const a = 'terminated aaa';\\n\n// Comment 'or'\\n\nconst b = 'not terminated bbb\")\n       (re-search-forward \"term\")\n       (should-not-fail (save-excursion (re-search-forward \"aaa\")))\n       (re-search-forward \"Comment \")\n       (should-fail)\n       (forward-char)\n       (should-fail)\n       (re-search-forward \"or\")\n       (should-fail)))\n    ;; Ignores template strings.\n    (test-with-temp-buffer\n     \"const a = `terminated aaa`\"\n     (re-search-forward \"term\")\n     (should-fail))))\n\n(ert-deftest typescript-convert-to-template ()\n  \"Unit tests for `typescript-convert-to-template'.\"\n  (cl-flet\n      ((should-do-nothing (str regexp)\n                    (test-with-temp-buffer\n                     str\n                     (re-search-forward regexp)\n                     (typescript-convert-to-template)\n                     (should (string-equal (typescript-test-get-doc) str))))\n       (should-modify (str delimiter regexp)\n                    (test-with-temp-buffer\n                     str\n                     (re-search-forward regexp)\n                     (typescript-convert-to-template)\n                     (should (string-equal (typescript-test-get-doc)\n                                           (replace-regexp-in-string delimiter \"`\" str))))))\n    (dolist (delimiter '(\"'\" \"\\\"\"))\n      (let ((str (replace-regexp-in-string \"'\" delimiter \"const a = 'not terminated\")))\n        (dolist (move-to '(\"const\" \"not\"))\n          (should-do-nothing str move-to)))\n      (let ((str (replace-regexp-in-string \"'\" delimiter \"const a = 'terminated'\")))\n        (should-do-nothing str \"const\")\n        (should-modify str delimiter delimiter)\n        (should-modify str delimiter \"term\")\n        (should-modify str delimiter \"terminated\"))\n      ;; Delimiters in comments.\n      (let ((str (replace-regexp-in-string \"'\" delimiter \"const a = 'terminated aaa';\\n\n// Comment 'or'\\n\nconst b = 'not terminated bbb\")))\n        (should-do-nothing str \"Comment \")))\n    ;; Ignores template strings.\n    (let ((str \"const a = `terminated aaa`\"))\n      (should-do-nothing str \"terminated\"))))\n\n(ert-deftest typescript-autoconvert-to-template ()\n  \"Unit tests for `typescript-autoconvert-to-template'.\"\n  (cl-flet\n      ((should-do-nothing (str regexp)\n                    (test-with-temp-buffer\n                     str\n                     (re-search-forward regexp)\n                     (typescript-autoconvert-to-template)\n                     (should (string-equal (typescript-test-get-doc) str))))\n       (should-modify (str delimiter regexp)\n                    (test-with-temp-buffer\n                     str\n                     (re-search-forward regexp)\n                     (typescript-autoconvert-to-template)\n                     (should (string-equal (typescript-test-get-doc)\n                                           (replace-regexp-in-string delimiter \"`\" str))))))\n    (dolist (delimiter '(\"'\" \"\\\"\"))\n      (let ((str (replace-regexp-in-string \"'\" delimiter \"const a = 'terminated'\")))\n        (should-do-nothing str \"= \")\n        (should-do-nothing str \"terminated\"))\n      (let ((str (replace-regexp-in-string \"'\" delimiter \"const a = '${foo}'\")))\n        (should-do-nothing str \"= \")\n        (should-modify str delimiter (concat \"foo}\" delimiter))))))\n\n(ert-deftest typescript-autoconvert-to-template-is-invoked ()\n  \"Test that we call `typescript-autoconvert-to-template' as needed.\"\n  (cl-flet\n      ((should-do-nothing (str delimiter)\n                    (test-with-temp-buffer\n                     str\n                     (goto-char (point-max))\n                     (execute-kbd-macro delimiter)\n                     (should (string-equal (typescript-test-get-doc) (concat str delimiter)))))\n       (should-modify (str delimiter)\n                    (test-with-temp-buffer\n                     str\n                     (goto-char (point-max))\n                     (execute-kbd-macro delimiter)\n                     (should (string-equal (typescript-test-get-doc)\n                                           (replace-regexp-in-string delimiter \"`\" (concat str delimiter)))))))\n    (dolist (delimiter '(\"'\" \"\\\"\"))\n      (let ((str (replace-regexp-in-string \"'\" delimiter \"const a = '${foo}\")))\n        (should-do-nothing str delimiter)\n        (let ((typescript-autoconvert-to-template-flag t))\n          (should-modify str delimiter))))))\n\n;; compilation-mode tests\n\n(ert-deftest recognizes-tsc-errors ()\n\n  (dolist (test-case\n           `((\"test.ts(2,7): error TS2322: Type '2' is not assignable to type 'string'.\"\n              ,typescript-tsc-error-regexp\n              \"test.ts\")\n\n             (\"test.ts:2:7 - error TS2322: Type '2' is not assignable to type 'string'.\"\n              ,typescript-tsc-pretty-error-regexp\n              \"test.ts\")\n             ))\n    (let* ((text (car test-case))\n           (regexp    (cadr test-case))\n           (matched-file-name (cl-caddr test-case))\n           (times     1))\n      (with-temp-buffer\n        (insert text)\n        (goto-char (point-min))\n\n        (re-search-forward regexp)\n        (should\n         (equal matched-file-name (match-string 1)))))))\n\n\n(provide 'typescript-mode-general-tests)\n\n;;; typescript-mode-general-tests.el ends here\n"
  },
  {
    "path": "typescript-mode-jsdoc-tests.el",
    "content": ";;; typescript-mode-jsdoc-tests --- This file contains JSDoc related tests for typescript-mode.el\n\n;;; Commentary:\n;; To understand the definition of JSDoc tag,\n;; see  https://github.com/jsdoc3/jsdoc/blob/b21427343c7294bbf1f14c718a390f3e955e37cb/lib/jsdoc/tag.js#L153-L195\n;; To know how to run the tests, see typescript-mode-tests.el\n\n;;; Code:\n\n(require 'ert)\n(require 'typescript-mode)\n(require 'typescript-mode-test-utilities)\n\n(defun jsdoc-multiline-test (jsdoc-lines specs)\n  \"Perform a multi-line JSDoc test against specs.\n`JSDOC-LINES' are converted into a multi-line JS comment, and\nthe comment is tested against `SPECS'.\nFor more information about how to write `SPECS', see `font-lock-test'.\"\n  (let* ((unwrapped-comment-lines\n          (mapcar (lambda (line) (concat \" * \" line \"\\n\")) jsdoc-lines))\n         (comment-lines\n          (append '(\"/**\\n\") unwrapped-comment-lines '(\" */\"))))\n    (font-lock-test\n     (apply #'concat comment-lines)\n     (cons\n      '(1 . font-lock-comment-delimiter-face)\n      specs))))\n\n;; Internal tags (or essential tags)\n;; See https://github.com/jsdoc3/jsdoc/blob/b21427343c7294bbf1f14c718a390f3e955e37cb/lib/jsdoc/tag/dictionary/definitions.js#L222-L256\n\n(ert-deftest jsdoc/also-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @also tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@also\"\n     )\n   '(\n     ;; (\"@also$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/also-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @also tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@also extra text\"\n     )\n   '(\n     ;; (\"@also extra text\" . typescript-jsdoc-tag)\n     (\"extra text\" . font-lock-comment-face)\n     (\"text\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/also-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @also tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/description-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @description tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@description descriptionInSingleWord\"\n     \"@description description about something\"\n     \"@description\"\n     \"multi-line description about other things\"\n     \"@desc descInSingleWord\"\n     \"@desc desc about something\"\n     \"@desc\"\n     \"multi-line desc about other things\"\n     )\n   '(\n     (\"@description descriptionInSingleWord\" . typescript-jsdoc-tag)\n     (\"descriptionInSingleWord\" . font-lock-comment-face)\n     (\"@description description about something\" . typescript-jsdoc-tag)\n     (\"description about something\" . font-lock-comment-face)\n     (\"about something\" . font-lock-comment-face)\n     (\"something\" . font-lock-comment-face)\n     (\"@description$\" . typescript-jsdoc-tag)\n     (\"multi-line description about other things\" . font-lock-comment-face)\n     (\"@desc descInSingleWord\" . typescript-jsdoc-tag)\n     (\"descInSingleWord\" . font-lock-comment-face)\n     (\"@desc desc about something\" . typescript-jsdoc-tag)\n     (\"desc about something\" . font-lock-comment-face)\n     (\"about something\" . font-lock-comment-face)\n     (\"something\" . font-lock-comment-face)\n     (\"@desc$\" . typescript-jsdoc-tag)\n     (\"multi-line desc about other things\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/description-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @description tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@description {DescriptionType}\"\n     \"@desc {DescType}\"\n     )\n   '(\n     (\"@description {DescriptionType}\" . typescript-jsdoc-tag)\n     (\"{DescriptionType}\" . font-lock-comment-face)\n     (\"@desc {DescType}\" . typescript-jsdoc-tag)\n     (\"{DescType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/description-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @description tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@description\"\n     \"@desc\"\n     )\n   '(\n     ;; (\"@description$\" . font-lock-comment-face)\n     ;; (\"@desc$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/kind-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @kind tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@kind class\"\n     \"@kind constant\"\n     \"@kind event\"\n     \"@kind external\"\n     \"@kind file\"\n     \"@kind function\"\n     \"@kind member\"\n     \"@kind mixin\"\n     \"@kind module\"\n     \"@kind namespace\"\n     \"@kind typedef\"\n     )\n   '(\n     (\"@kind class\" . typescript-jsdoc-tag)\n     (\"class\" . typescript-jsdoc-value)\n     (\"@kind constant\" . typescript-jsdoc-tag)\n     (\"constant\" . typescript-jsdoc-value)\n     (\"@kind event\" . typescript-jsdoc-tag)\n     (\"event\" . typescript-jsdoc-value)\n     (\"@kind external\" . typescript-jsdoc-tag)\n     (\"external\" . typescript-jsdoc-value)\n     (\"@kind file\" . typescript-jsdoc-tag)\n     (\"file\" . typescript-jsdoc-value)\n     (\"@kind function\" . typescript-jsdoc-tag)\n     (\"function\" . typescript-jsdoc-value)\n     (\"@kind member\" . typescript-jsdoc-tag)\n     (\"member\" . typescript-jsdoc-value)\n     (\"@kind mixin\" . typescript-jsdoc-tag)\n     (\"mixin\" . typescript-jsdoc-value)\n     (\"@kind module\" . typescript-jsdoc-tag)\n     (\"module\" . typescript-jsdoc-value)\n     (\"@kind namespace\" . typescript-jsdoc-tag)\n     (\"namespace\" . typescript-jsdoc-value)\n     (\"@kind typedef\" . typescript-jsdoc-tag)\n     (\"typedef\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/kind-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @kind tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@kind meaninglessKind\"\n     \"@kind {KindType}\"\n     )\n   '(\n     (\"@kind meaninglessKind\" . typescript-jsdoc-tag)\n     (\"meaninglessKind\" . typescript-jsdoc-value)\n     (\"@kind {KindType}\" . typescript-jsdoc-tag)\n     (\"{KindType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/kind-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @kind tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@kind\"\n     )\n   '(\n     (\"@kind$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/name-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @name tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@name someName\"\n     )\n   '(\n     (\"@name someName\" . typescript-jsdoc-tag)\n     (\"someName\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/name-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @name tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@name {NameType}\"\n     )\n   '(\n     (\"@name {NameType}\" . typescript-jsdoc-tag)\n     (\"{NameType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/name-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @name tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@name\"\n     )\n   '(\n     (\"@name$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/undocumented-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @undocumented tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@undocumented\"\n     )\n   '(\n     ;; (\"@undocumented\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/undocumented-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @undocumented tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/undocumented-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @undocumented tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@undocumented invalidValue\"\n     \"@undocumented {InvalidType}\"\n     )\n   '(\n     (\"@undocumented invalidValue\" . font-lock-comment-face)\n     (\"invalidValue\" . font-lock-comment-face)\n     (\"@undocumented {InvalidType}\" . font-lock-comment-face)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n;; Basic tags\n;; See https://github.com/jsdoc3/jsdoc/blob/b21427343c7294bbf1f14c718a390f3e955e37cb/lib/jsdoc/tag/dictionary/definitions.js#L260-L858\n;; for details of following tag tests\n\n(ert-deftest jsdoc/abstract-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @abstract tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@abstract\"\n     \"@virtual\"\n     )\n   '(\n     (\"@abstract\" . typescript-jsdoc-tag)\n     (\"@virtual\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/abstract-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @abstract tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/abstract-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @abstract tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@abstract invalid extra value0\"\n     \"@abstract {InvalidType0}\"\n     \"@virtual invalid extra value1\"\n     \"@virtual {InvalidType1}\"\n     )\n   '(\n     (\"@abstract invalid extra value0\" . typescript-jsdoc-tag)\n     (\"invalid extra value0\" . font-lock-comment-face)\n     (\"extra value0\" . font-lock-comment-face)\n     (\"value0\" . font-lock-comment-face)\n     (\"@abstract {InvalidType0}\" . typescript-jsdoc-tag)\n     (\"{InvalidType0}\" . font-lock-comment-face)\n     (\"@virtual invalid extra value1\" . typescript-jsdoc-tag)\n     (\"invalid extra value1\" . font-lock-comment-face)\n     (\"extra value1\" . font-lock-comment-face)\n     (\"value1\" . font-lock-comment-face)\n     (\"@virtual {InvalidType1}\" . typescript-jsdoc-tag)\n     (\"{InvalidType1}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/access-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @access tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@access package\"\n     \"@access private\"\n     \"@access protected\"\n     \"@access public\"\n     )\n   '(\n     (\"@access package\" . typescript-jsdoc-tag)\n     (\"package\" . typescript-jsdoc-value)\n     (\"@access private\" . typescript-jsdoc-tag)\n     (\"private\" . typescript-jsdoc-value)\n     (\"@access protected\" . typescript-jsdoc-tag)\n     (\"protected\" . typescript-jsdoc-value)\n     (\"@access public\" . typescript-jsdoc-tag)\n     (\"public\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/access-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @access tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@access meaninglessAccess\"\n     \"@access {AccessType}\"\n     )\n   '(\n     (\"@access meaninglessAccess\" . typescript-jsdoc-tag)\n     (\"meaninglessAccess\" . typescript-jsdoc-value)\n     (\"@access {AccessType}\" . typescript-jsdoc-tag)\n     (\"{AccessType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/access-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @access tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@access\"\n     )\n   '(\n     (\"@access$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/alias-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @alias tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@alias exampleAlias0\"\n     \"@alias somenamespace.exampleAlias1\"\n     )\n   '(\n     (\"@alias exampleAlias0\" . typescript-jsdoc-tag)\n     (\"exampleAlias0\" . typescript-jsdoc-value)\n     (\"@alias somenamespace.exampleAlias1\" . typescript-jsdoc-tag)\n     (\"somenamespace.exampleAlias1\" . typescript-jsdoc-value)\n     (\"exampleAlias1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/alias-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @alias tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@alias multiple words\"\n     \"@alias {AliasType}\"\n     )\n   '(\n     (\"@alias multiple words\" . typescript-jsdoc-tag)\n     (\"multiple words\" . typescript-jsdoc-value)\n     ;; (\"words\" . typescript-jsdoc-value)\n     (\"@alias {AliasType}\" . typescript-jsdoc-tag)\n     (\"{AliasType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/alias-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @alias tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@alias\"\n     )\n   '(\n     (\"@alias$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/async-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @async tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@async\"\n     )\n   '(\n     (\"@async\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/async-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @async tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/async-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @async tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@async invalid extra value\"\n     \"@async {InvalidType}\"\n     )\n   '(\n     (\"@async invalid extra value\" . typescript-jsdoc-tag)\n     (\"invalid extra value\" . font-lock-comment-face)\n     (\"extra value\" . font-lock-comment-face)\n     (\"value\" . font-lock-comment-face)\n     (\"@async {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/augments-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @augments tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@augments ExampleAugmented0\"\n     \"@augments {ExampleAugmented1}\"\n     \"@extends ExampleExtended0\"\n     \"@extends {ExampleExtended1}\"\n     )\n   '(\n     (\"@augments ExampleAugmented0\" . typescript-jsdoc-tag)\n     (\"ExampleAugmented0\" . typescript-jsdoc-value)\n     (\"@augments {ExampleAugmented1}\" . typescript-jsdoc-tag)\n     ;; (\"{ExampleAugmented1}\" . typescript-jsdoc-type)\n     (\"@extends ExampleExtended0\" . typescript-jsdoc-tag)\n     (\"ExampleExtended0\" . typescript-jsdoc-value)\n     (\"@extends {ExampleExtended1}\" . typescript-jsdoc-tag)\n     ;; (\"{ExampleExtended1}\" . typescript-jsdoc-type)\n     )))\n\n(ert-deftest jsdoc/augments-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @augments tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@augments {ExampleAugmented0} extra augments value\"\n     \"@extends {ExampleExtended0} extra extends value\"\n     )\n   '(\n     (\"@augments {ExampleAugmented0} extra augments value\" . typescript-jsdoc-tag)\n     ;; (\"{ExampleAugmented0} extra augments value\" . typescript-jsdoc-type)\n     (\"extra augments value\" . font-lock-comment-face)\n     (\"augments value\" . font-lock-comment-face)\n     (\"value\" . font-lock-comment-face)\n     (\"@extends {ExampleExtended0} extra extends value\" . typescript-jsdoc-tag)\n     ;; (\"{ExampleExtended0} extra extends value\" . typescript-jsdoc-type)\n     (\"extra extends value\" . font-lock-comment-face)\n     (\"extends value\" . font-lock-comment-face)\n     (\"value\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/augments-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @augments tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@augments\"\n     \"@extends\"\n     )\n   '(\n     (\"@augments$\" . font-lock-comment-face)\n     ;; (\"@extends$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/author-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @author tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@author Exampleauthor\"\n     \"@author Exampleauthor Withfamilyname\"\n     \"@author Exampleauthor <example@author.email>\"\n     )\n   '(\n     (\"@author Exampleauthor$\" . typescript-jsdoc-tag)\n     ;; (\"Exampleauthor\" . typescript-jsdoc-value)\n     (\"@author Exampleauthor Withfamilyname\" . typescript-jsdoc-tag)\n     ;; (\"Exampleauthor Withfamilyname\" . typescript-jsdoc-value)\n     ;; (\"Withfamilyname\" . typescript-jsdoc-value)\n     (\"@author Exampleauthor <example@author.email>\" . typescript-jsdoc-tag)\n     ;; (\"Exampleauthor <example@author.email>\" . typescript-jsdoc-value)\n     ;; (\"<example@author.email>\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/author-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @author tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@author {AuthorType}\"\n     )\n   '(\n     (\"@author {AuthorType}\" . typescript-jsdoc-tag)\n     ;; (\"{AuthorType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/author-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @author tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@author\"\n     )\n   '(\n     ;; (\"@author$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/borrows-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @borrows tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@borrows something0\"\n     \"@borrows originalName as borrowedName\"\n     )\n   '(\n     (\"@borrows something0\" . typescript-jsdoc-tag)\n     (\"something0\" . typescript-jsdoc-value)\n     (\"@borrows originalName as borrowedName\" . typescript-jsdoc-tag)\n     (\"originalName as borrowedName\" . typescript-jsdoc-value)\n     ;; (\"as borrowedName\" . typescript-jsdoc-value)\n     ;; (\"borrowedName\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/borrows-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @borrows tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@borrows meaningless multiple words\"\n     \"@borrows {BorrowType}\"\n     )\n   '(\n     (\"@borrows meaningless multiple words\" . typescript-jsdoc-tag)\n     (\"meaningless multiple words\" . typescript-jsdoc-value)\n     ;; (\"multiple words\" . typescript-jsdoc-value)\n     ;; (\"words\" . typescript-jsdoc-value)\n     (\"@borrows {BorrowType}\" . typescript-jsdoc-tag)\n     (\"{BorrowType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/borrows-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @borrows tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@borrows\"\n     \"@borrows {InvalidType}\"\n     )\n   '(\n     (\"@borrows$\" . font-lock-comment-face)\n     ;; (\"@borrows {InvalidType}\" . font-lock-comment-face)\n     ;; (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/class-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @class tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     ;; See https://github.com/jsdoc3/jsdoc/blob/b21427343c7294bbf1f14c718a390f3e955e37cb/lib/jsdoc/tag/dictionary/definitions.js#L318-L340\n     \"@class\"\n     \"@class ExampleClass\"\n     \"@class Class tag for description0\"\n     \"@class\"\n     \"Class tag for description1\"\n     \"@constructor\"\n     \"@constructor ExampleClassConstructor\"\n     ;; You cannot use @constructor to describe class\n     )\n   '(\n     (\"@class$\" . typescript-jsdoc-tag)\n     (\"@class ExampleClass\" . typescript-jsdoc-tag)\n     ;; (\"ExampleClass\" . typescript-jsdoc-value)\n     (\"@class Class tag for description0\" . typescript-jsdoc-tag)\n     (\"Class tag for description0\" . font-lock-comment-face)\n     (\"tag for description0\" . font-lock-comment-face)\n     (\"for description0\" . font-lock-comment-face)\n     (\"description0\" . font-lock-comment-face)\n     (\"Class tag for description1\" . font-lock-comment-face)\n     (\"tag for description1\" . font-lock-comment-face)\n     (\"for description1\" . font-lock-comment-face)\n     (\"description1\" . font-lock-comment-face)\n     (\"@constructor\" . typescript-jsdoc-tag)\n     ;; (\"ExampleClassConstructor\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/class-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @class tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@class {ClassType}\"\n     \"@constructor {ConstructorType}\"\n     )\n   '(\n     (\"@class {ClassType}\" . typescript-jsdoc-tag)\n     ;; (\"{ClassType}\" . typescript-jsdoc-value)\n     (\"@constructor {ConstructorType}\" . typescript-jsdoc-tag)\n     ;; (\"{ConstructorType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/class-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @class tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/classdesc-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @classdesc tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@classdesc\"\n     \"@classdesc This is class description0\"\n     \"@classdesc\"\n     \"This is class description1\"\n     )\n   '(\n     (\"@classdesc$\" . typescript-jsdoc-tag)\n     (\"@classdesc This is class description0\" . typescript-jsdoc-tag)\n     (\"This is class description0\" . font-lock-comment-face)\n     (\"is class description0\" . font-lock-comment-face)\n     (\"class description0\" . font-lock-comment-face)\n     (\"description0\" . font-lock-comment-face)\n     (\"This is class description1\" . font-lock-comment-face)\n     (\"is class description1\" . font-lock-comment-face)\n     (\"class description1\" . font-lock-comment-face)\n     (\"description1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/classdesc-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @classdesc tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@classdesc {ClassDescType}\"\n     )\n   '(\n     (\"@classdesc {ClassDescType}\" . typescript-jsdoc-tag)\n     (\"{ClassDescType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/classdesc-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @classdesc tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/constant-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @constant tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@constant\"\n     \"@constant {ConstantType0}\"\n     \"@constant constantName0\"\n     \"@constant {ConstantType1} constantName1\"\n     \"@const\"\n     \"@const {ConstType0}\"\n     \"@const constName0\"\n     \"@const {ConstType1} constName1\"\n     )\n   '(\n     (\"@constant$\" . typescript-jsdoc-tag)\n     (\"@constant {ConstantType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ConstantType0}\" . typescript-jsdoc-type)\n     (\"@constant constantName0\" . typescript-jsdoc-tag)\n     ;; (\"constantName0\" . typescript-jsdoc-value)\n     (\"@constant {ConstantType1} constantName1\" . typescript-jsdoc-tag)\n     ;; (\"{ConstantType1} constantName1\" . typescript-jsdoc-type)\n     ;; (\"constantName1\" . typescript-jsdoc-value)\n     (\"@const$\" . typescript-jsdoc-tag)\n     (\"@const {ConstType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ConstType0}\" . typescript-jsdoc-type)\n     (\"@const constName0\" . typescript-jsdoc-tag)\n     ;; (\"constName0\" . typescript-jsdoc-value)\n     (\"@const {ConstType1} constName1\" . typescript-jsdoc-tag)\n     ;; (\"{ConstType1} constName1\" . typescript-jsdoc-type)\n     ;; (\"constName1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/constant-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @constant tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@constant extra value other than name for constant0\"\n     \"@const extra value other than name for const0\"\n     )\n   '(\n     (\"@constant extra value other than name for constant0\" . typescript-jsdoc-tag)\n     ;; (\"extra value other than name for constant0\" . typescript-jsdoc-value)\n     (\"value other than name for constant0\" . font-lock-comment-face)\n     (\"other than name for constant0\" . font-lock-comment-face)\n     (\"than name for constant0\" . font-lock-comment-face)\n     (\"name for constant0\" . font-lock-comment-face)\n     (\"for constant0\" . font-lock-comment-face)\n     (\"constant0\" . font-lock-comment-face)\n     (\"@const extra value other than name for const0\" . typescript-jsdoc-tag)\n     ;; (\"extra value other than name for const0\" . typescript-jsdoc-value)\n     (\"value other than name for const0\" . font-lock-comment-face)\n     (\"other than name for const0\" . font-lock-comment-face)\n     (\"than name for const0\" . font-lock-comment-face)\n     (\"name for const0\" . font-lock-comment-face)\n     (\"for const0\" . font-lock-comment-face)\n     (\"const0\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/constant-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @constant tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/constructs-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @constructs tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@constructs\"\n     \"@constructs className\"\n     \"@constructs {@thisClass}\"\n     )\n   '(\n     (\"@constructs$\" . typescript-jsdoc-tag)\n     (\"@constructs className\" . typescript-jsdoc-tag)\n     ;; (\"className\" . typescript-jsdoc-value)\n     (\"@constructs {@thisClass}\" . typescript-jsdoc-tag)\n     ;; (\"{@thisClass}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/constructs-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @constructs tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@constructs className and extra description\"\n     \"@constructs {ClassType}\"\n     )\n   '(\n     (\"@constructs className and extra description\" . typescript-jsdoc-tag)\n     ;; (\"className and extra description\" . typescript-jsdoc-value)\n     (\"and extra description\" . font-lock-comment-face)\n     (\"extra description\" . font-lock-comment-face)\n     (\"description\" . font-lock-comment-face)\n     (\"@constructs {ClassType}\" . typescript-jsdoc-tag)\n     ;; (\"{ClassType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/constructs-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @constructs tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/copyright-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @copyright tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@copyright Some copyright texts\"\n     )\n   '(\n     (\"@copyright Some copyright texts\" . typescript-jsdoc-tag)\n     (\"Some copyright texts\" . font-lock-comment-face)\n     (\"copyright texts\" . font-lock-comment-face)\n     (\"texts\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/copyright-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @copyright tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@copyright {InvalidType}\"\n     )\n   '(\n     (\"@copyright {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/copyright-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @copyright tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@copyright\"\n     )\n   '(\n     ;; (\"@copyright$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/default-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @default tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@default\"\n     \"@default 5\"\n     \"@default true\"\n     \"@defaultvalue\"\n     \"@defaultvalue null\"\n     \"@defaultvalue \\\"abc\\\"\"\n     )\n   '(\n     (\"@default$\" . typescript-jsdoc-tag)\n     (\"@default 5\" . typescript-jsdoc-tag)\n     ;; (\"5\" . typescript-jsdoc-value)\n     (\"@default true\" . typescript-jsdoc-tag)\n     ;; (\"true\" . typescript-jsdoc-value)\n     (\"@defaultvalue$\" . typescript-jsdoc-tag)\n     (\"@defaultvalue null\" . typescript-jsdoc-tag)\n     ;; (\"null\" . typescript-jsdoc-value)\n     (\"@defaultvalue \\\"abc\\\"\" . typescript-jsdoc-tag)\n     ;; (\"\\\"abc\\\"\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/default-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @default tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@default multiple values for default0\"\n     \"@default {DefaultType}\"\n     \"@defaultvalue multiple values for defaultvalue0\"\n     \"@defaultvalue {DefaultValueType}\"\n     )\n   '(\n     (\"@default multiple values for default0\" . typescript-jsdoc-tag)\n     ;; (\"multiple values for default0\" . typescript-jsdoc-value)\n     ;; (\"values for default0\" . typescript-jsdoc-value)\n     ;; (\"for default0\" . typescript-jsdoc-value)\n     ;; (\"default0\" . typescript-jsdoc-value)\n     (\"@default {DefaultType}\" . typescript-jsdoc-tag)\n     ;; (\"{DefaultType}\" . typescript-jsdoc-value)\n     (\"@defaultvalue multiple values for defaultvalue0\" . typescript-jsdoc-tag)\n     ;; (\"multiple values for defaultvalue0\" . typescript-jsdoc-value)\n     ;; (\"values for defaultvalue0\" . typescript-jsdoc-value)\n     ;; (\"for defaultvalue0\" . typescript-jsdoc-value)\n     ;; (\"defaultvalue0\" . typescript-jsdoc-value)\n     (\"@defaultvalue {DefaultValueType}\" . typescript-jsdoc-tag)\n     ;; (\"{DefaultValueType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/default-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @default tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/deprecated-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @deprecated tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@deprecated\"\n     \"@deprecated Some explanations about deprecation\"\n     )\n   '(\n     (\"@deprecated$\" . typescript-jsdoc-tag)\n     (\"@deprecated Some explanations about deprecation\" . typescript-jsdoc-tag)\n     (\"Some explanations about deprecation\" . font-lock-comment-face)\n     (\"explanations about deprecation\" . font-lock-comment-face)\n     (\"about deprecation\" . font-lock-comment-face)\n     (\"deprecation\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/deprecated-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @deprecated tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@deprecated {DeprecatedType}\"\n     )\n   '(\n     (\"@deprecated {DeprecatedType}\" . typescript-jsdoc-tag)\n     (\"{DeprecatedType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/deprecated-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @deprecated tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/enum-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @enum tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@enum\"\n     \"@enum {EnumItemType}\"\n     )\n   '(\n     (\"@enum$\" . typescript-jsdoc-tag)\n     (\"@enum {EnumItemType}\" . typescript-jsdoc-tag)\n     (\"{EnumItemType}\" . typescript-jsdoc-type)\n     )))\n\n(ert-deftest jsdoc/enum-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @enum tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@enum meaningless description0\"\n     \"@enum {EnumItemType} meaningless description1\"\n     )\n   '(\n     (\"@enum meaningless description0\" . typescript-jsdoc-tag)\n     (\"meaningless description0\" . font-lock-comment-face)\n     (\"description0\" . font-lock-comment-face)\n     (\"@enum {EnumItemType} meaningless description1\" . typescript-jsdoc-tag)\n     (\"{EnumItemType} meaningless description1\" . typescript-jsdoc-type)\n     (\"meaningless description1\" . font-lock-comment-face)\n     (\"description1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/enum-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @enum tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/event-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @event tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@event\"\n     \"@event SomeClass#exampleEvent\"\n     )\n   '(\n     (\"@event$\" . typescript-jsdoc-tag)\n     (\"@event SomeClass#exampleEvent\" . typescript-jsdoc-tag)\n     ;; (\"SomeClass#exampleEvent\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/event-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @event tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@event justText\"\n     \"@event {EventType}\"\n     )\n   '(\n     (\"@event justText\" . typescript-jsdoc-tag)\n     ;; (\"justText\" . typescript-jsdoc-value)\n     (\"@event {EventType}\" . typescript-jsdoc-tag)\n     ;; (\"{EventType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/event-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @event tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/example-tag-in-multiline-doc-comment-with-meaninglful-cases ()\n  \"Test for meaningful and valid usage of @example tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@example inlineExample with multiple terms0\"\n     \"@example\"\n     \"With multiline and multiple terms1\"\n     )\n   '(\n     (\"@example inlineExample with multiple terms\" . typescript-jsdoc-tag)\n     ;; (\"inlineExample with multiple terms\" . typescript-jsdoc-value)\n     ;; (\"with multiple terms\" . typescript-jsdoc-value)\n     ;; (\"multiple terms\" . typescript-jsdoc-value)\n     ;; (\"terms\" . typescript-jsdoc-value)\n     (\"@example$\" . typescript-jsdoc-tag)\n     ;; (\"With multiline and multiple terms1\" . typescript-jsdoc-value)\n     ;; (\"multiline and multiple terms1\" . typescript-jsdoc-value)\n     ;; (\"and multiple terms1\" . typescript-jsdoc-value)\n     ;; (\"multiple terms1\" . typescript-jsdoc-value)\n     ;; (\"terms1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/example-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @example tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/example-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @example tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@example\"\n     )\n   '(\n     ;; (\"@example$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/exports-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @exports tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@exports some/module\"\n     )\n   '(\n     (\"@exports some/module\" . typescript-jsdoc-tag)\n     ;; (\"some/module\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/exports-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @exports tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@exports justText\"\n     \"@exports {ExportType}\"\n     )\n   '(\n     (\"@exports justText\" . typescript-jsdoc-tag)\n     ;; (\"justText\" . typescript-jsdoc-value)\n     (\"@exports {ExportType}\" . typescript-jsdoc-tag)\n     ;; (\"{ExportType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/exports-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @exports tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@exports\"\n     )\n   '(\n     ;; (\"@exports$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/external-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @external tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@external\"\n     \"@external String\"\n     \"@external \\\"jQuery.fn\\\"\"\n     \"@external {ExternalType0}\"\n     \"@external {ExternalType1} ExternalValue\"\n     \"@host\"\n     \"@host Boolean\"\n     \"@host \\\"jQuery.fn.pluginNamespace\\\"\"\n     \"@host {HostType0}\"\n     \"@host {HostType1} HostValue\"\n     )\n   '(\n     ;; (\"@external$\" . typescript-jsdoc-tag)\n     (\"@external String\" . typescript-jsdoc-tag)\n     (\"String\" . typescript-jsdoc-value)\n     (\"@external \\\"jQuery.fn\\\"\" . typescript-jsdoc-tag)\n     (\"\\\"jQuery.fn\\\"\" . typescript-jsdoc-value)\n     (\"@external {ExternalType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ExternalType0}\" . typescript-jsdoc-type)\n     (\"@external {ExternalType1} ExternalValue\" . typescript-jsdoc-tag)\n     ;; (\"{ExternalType1} ExternalValue\" . typescript-jsdoc-type)\n     ;; (\"ExternalValue\" . typescript-jsdoc-value)\n     ;; (\"@host$\" . typescript-jsdoc-tag)\n     (\"@host Boolean\" . typescript-jsdoc-tag)\n     (\"Boolean\" . typescript-jsdoc-value)\n     (\"@host \\\"jQuery.fn.pluginNamespace\\\"\" . typescript-jsdoc-tag)\n     (\"\\\"jQuery.fn.pluginNamespace\\\"\" . typescript-jsdoc-value)\n     (\"@host {HostType0}\" . typescript-jsdoc-tag)\n     ;; (\"{HostType0}\" . typescript-jsdoc-type)\n     (\"@host {HostType1} HostValue\" . typescript-jsdoc-tag)\n     ;; (\"{HostType1} HostValue\" . typescript-jsdoc-type)\n     ;; (\"HostValue\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/external-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @external tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@external multiple words0\"\n     \"@host multiple words1\"\n     )\n   '(\n     (\"@external multiple words0\" . typescript-jsdoc-tag)\n     (\"multiple words0\" . typescript-jsdoc-value)\n     ;; (\"words0\" . typescript-jsdoc-value)\n     (\"@host multiple words1\" . typescript-jsdoc-tag)\n     (\"multiple words1\" . typescript-jsdoc-value)\n     ;; (\"words1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/external-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @external tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@external\"\n     )\n   '(\n     ;; (\"@external$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/file-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @file tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@file\"\n     \"@file description for file0\"\n     \"@fileoverview\"\n     \"@fileoverview description for file1\"\n     \"@overview\"\n     \"@overview description for file2\"\n     )\n   '(\n     (\"@file$\" . typescript-jsdoc-tag)\n     (\"@file description for file0\" . typescript-jsdoc-tag)\n     (\"description for file0\" . font-lock-comment-face)\n     (\"for file0\" . font-lock-comment-face)\n     (\"file0\" . font-lock-comment-face)\n     (\"@fileoverview$\" . typescript-jsdoc-tag)\n     (\"@fileoverview description for file1\" . typescript-jsdoc-tag)\n     (\"description for file1\" . font-lock-comment-face)\n     (\"for file1\" . font-lock-comment-face)\n     (\"file1\" . font-lock-comment-face)\n     (\"@overview$\" . typescript-jsdoc-tag)\n     (\"@overview description for file2\" . typescript-jsdoc-tag)\n     (\"description for file2\" . font-lock-comment-face)\n     (\"for file2\" . font-lock-comment-face)\n     (\"file2\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/file-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @file tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@file {FileType}\"\n     \"@fileoverview {FileOverviewType}\"\n     \"@overview {OverviewType}\"\n     )\n   '(\n     (\"@file {FileType}\" . typescript-jsdoc-tag)\n     (\"{FileType}\" . font-lock-comment-face)\n     (\"@fileoverview {FileOverviewType}\" . typescript-jsdoc-tag)\n     (\"{FileOverviewType}\" . font-lock-comment-face)\n     (\"@overview {OverviewType}\" . typescript-jsdoc-tag)\n     (\"{OverviewType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/file-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @file tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/fires-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @fires tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@fires SomeClass#eventName0\"\n     \"@emits SomeClass#eventName1\"\n     )\n   '(\n     (\"@fires SomeClass#eventName0\" . typescript-jsdoc-tag)\n     (\"SomeClass#eventName0\" . typescript-jsdoc-value)\n     (\"@emits SomeClass#eventName1\" . typescript-jsdoc-tag)\n     (\"SomeClass#eventName1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/fires-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @fires tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@fires just text\"\n     \"@fires {FiresType}\"\n     \"@emits any text\"\n     \"@emits {EmitsType}\"\n     )\n   '(\n     (\"@fires just text\" . typescript-jsdoc-tag)\n     (\"just text\" . typescript-jsdoc-value)\n     (\"text\" . font-lock-comment-face)\n     (\"@fires {FiresType}\" . typescript-jsdoc-tag)\n     (\"{FiresType}\" . typescript-jsdoc-value)\n     (\"@emits any text\" . typescript-jsdoc-tag)\n     (\"any text\" . typescript-jsdoc-value)\n     (\"text\" . font-lock-comment-face)\n     (\"@emits {EmitsType}\" . typescript-jsdoc-tag)\n     (\"{EmitsType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/fires-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @fires tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@fires\"\n     \"@emits\"\n     )\n   '(\n     (\"@fires$\" . font-lock-comment-face)\n     (\"@emits$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/function-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @function tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@function\"\n     \"@function functionName\"\n     \"@func\"\n     \"@func funcName\"\n     \"@method\"\n     \"@method methodName\"\n     )\n   '(\n     (\"@function$\" . typescript-jsdoc-tag)\n     (\"@function functionName\" . typescript-jsdoc-tag)\n     (\"functionName\" . typescript-jsdoc-value)\n     (\"@func$\" . typescript-jsdoc-tag)\n     (\"@func funcName\" . typescript-jsdoc-tag)\n     (\"funcName\" . typescript-jsdoc-value)\n     (\"@method$\" . typescript-jsdoc-tag)\n     (\"@method methodName\" . typescript-jsdoc-tag)\n     (\"methodName\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/function-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @function tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@function multiple words for function0\"\n     \"@function {FunctionType}\"\n     \"@func multiple words for func0\"\n     \"@func {FuncType}\"\n     \"@method multiple words for method0\"\n     \"@method {MethodType}\"\n     )\n   '(\n     (\"@function multiple words for function0\" . typescript-jsdoc-tag)\n     (\"multiple words for function0\" . typescript-jsdoc-value)\n     (\"words for function0\" . font-lock-comment-face)\n     (\"for function0\" . font-lock-comment-face)\n     (\"function0\" . font-lock-comment-face)\n     (\"@function {FunctionType}\" . typescript-jsdoc-tag)\n     (\"{FunctionType}\" . typescript-jsdoc-value)\n     (\"@func multiple words for func0\" . typescript-jsdoc-tag)\n     (\"multiple words for func0\" . typescript-jsdoc-value)\n     (\"words for func0\" . font-lock-comment-face)\n     (\"for func0\" . font-lock-comment-face)\n     (\"func0\" . font-lock-comment-face)\n     (\"@func {FuncType}\" . typescript-jsdoc-tag)\n     (\"{FuncType}\" . typescript-jsdoc-value)\n     (\"@method multiple words for method0\" . typescript-jsdoc-tag)\n     (\"multiple words for method0\" . typescript-jsdoc-value)\n     (\"words for method0\" . font-lock-comment-face)\n     (\"for method0\" . font-lock-comment-face)\n     (\"method0\" . font-lock-comment-face)\n     (\"@method {MethodType}\" . typescript-jsdoc-tag)\n     (\"{MethodType}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/function-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @function tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/generator-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @generator tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@generator\"\n     )\n   '(\n     (\"@generator$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/generator-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @generator tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/generator-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @generator tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@generator invalid extra values\"\n     \"@generator {InvalidType}\"\n     )\n   '(\n     (\"@generator invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@generator {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/global-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @global tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@global\"\n     )\n   '(\n     (\"@global$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/global-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @global tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/global-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @global tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@global invalid extra values\"\n     \"@global {InvalidType}\"\n     )\n   '(\n     (\"@global invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@global {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/hideconstructor-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @hideconstructor tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@hideconstructor\"\n     )\n   '(\n     (\"@hideconstructor$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/hideconstructor-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @hideconstructor tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/hideconstructor-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @hideconstructor tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@hideconstructor invalid extra values\"\n     \"@hideconstructor {InvalidType}\"\n     )\n   '(\n     (\"@hideconstructor invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@hideconstructor {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/ignore-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @ignore tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@ignore\"\n     )\n   '(\n     (\"@ignore$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/ignore-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @ignore tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/ignore-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @ignore tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@ignore invalid extra values\"\n     \"@ignore {InvalidType}\"\n     )\n   '(\n     (\"@ignore invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@ignore {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/implements-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @implements tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@implements SomeInterface\"\n     \"@implements {OtherInterface}\"\n     )\n   '(\n     (\"@implements SomeInterface\" . typescript-jsdoc-tag)\n     ;; (\"SomeInterface\" . typescript-jsdoc-value)\n     (\"@implements {OtherInterface}\" . typescript-jsdoc-tag)\n     (\"{OtherInterface}\" . typescript-jsdoc-type)\n     )))\n\n(ert-deftest jsdoc/implements-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @implements tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@implements {Interface0} Interface1\"\n     )\n   '(\n     (\"@implements {Interface0} Interface1\" . typescript-jsdoc-tag)\n     (\"{Interface0} Interface1\" . typescript-jsdoc-type)\n     (\"Interface1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/implements-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @implements tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@implements\"\n     )\n   '(\n     ;; (\"@implements$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/inheritdoc-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @inheritdoc tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@inheritdoc\"\n     )\n   '(\n     (\"@inheritdoc$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/inheritdoc-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @inheritdoc tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/inheritdoc-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @inheritdoc tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@inheritdoc invalid extra values\"\n     \"@inheritdoc {InvalidType}\"\n     )\n   '(\n     (\"@inheritdoc invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@inheritdoc {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/inner-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @inner tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@inner\"\n     )\n   '(\n     (\"@inner$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/inner-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @inner tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@inner extra values\"\n     \"@inner {InnerType}\"\n     )\n   '(\n     (\"@inner extra values\" . typescript-jsdoc-tag)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@inner {InnerType}\" . typescript-jsdoc-tag)\n     (\"{InnerType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/inner-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @inner tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/instance-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @instance tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@instance\"\n     )\n   '(\n     (\"@instance$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/instance-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @instance tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@instance extra values\"\n     \"@instance {InstanceType}\"\n     )\n   '(\n     (\"@instance extra values\" . typescript-jsdoc-tag)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@instance {InstanceType}\" . typescript-jsdoc-tag)\n     (\"{InstanceType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/instance-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @instance tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/interface-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @interface tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@interface\"\n     \"@interface InterfaceName\"\n     )\n   '(\n     (\"@interface$\" . typescript-jsdoc-tag)\n     (\"@interface InterfaceName\" . typescript-jsdoc-tag)\n     ;; (\"InterfaceName\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/interface-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @interface tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@interface extra values\"\n     \"@interface {InterfaceType0}\"\n     \"@interface {InterfaceType1} AndName\"\n     )\n   '(\n     (\"@interface extra values\" . typescript-jsdoc-tag)\n     ;; (\"extra values\" . typescript-jsdoc-value)\n     (\"values\" . font-lock-comment-face)\n     (\"@interface {InterfaceType0}\" . typescript-jsdoc-tag)\n     ;; (\"{InterfaceType0}\" . typescript-jsdoc-value)\n     (\"@interface {InterfaceType1} AndName\" . typescript-jsdoc-tag)\n     ;; (\"{InterfaceType1} AndName\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/interface-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @interface tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/lends-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @lends tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@lends\"\n     \"@lends Something\"\n     \"@lends Something.deeper\"\n     )\n   '(\n     (\"@lends$\" . typescript-jsdoc-tag)\n     (\"@lends Something\" . typescript-jsdoc-tag)\n     ;; (\"Something\" . typescript-jsdoc-value)\n     (\"@lends Something.deeper\" . typescript-jsdoc-tag)\n     ;; (\"Something.deeper\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/lends-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @lends tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@lends {LendsType0}\"\n     \"@lends {LendsType1} With.some.path\"\n     )\n   '(\n     (\"@lends {LendsType0}\" . typescript-jsdoc-tag)\n     ;; (\"{LendsType0}\" . nil)\n     (\"@lends {LendsType1} With.some.path\" . typescript-jsdoc-tag)\n     ;; (\"{LendsType1} With.some.path\" . nil)\n     ;; (\"With.some.path\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/lends-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @lends tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/license-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @license tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@license Some-License-Name\"\n     \"@license\"\n     \"Some long license texts\"\n     )\n   '(\n     (\"@license Some-License-Name\" . typescript-jsdoc-tag)\n     (\"Some-License-Name\" . font-lock-comment-face)\n     (\"@license$\" . typescript-jsdoc-tag)\n     (\"Some long license texts\" . font-lock-comment-face)\n     (\"long license texts\" . font-lock-comment-face)\n     (\"license texts\" . font-lock-comment-face)\n     (\"texts\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/license-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @license tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@license {LicenseType0}\"\n     \"@license {LicenseType1} With more text\"\n     )\n   '(\n     (\"@license {LicenseType0}\" . typescript-jsdoc-tag)\n     (\"{LicenseType0}\" . font-lock-comment-face)\n     (\"@license {LicenseType1} With more text\" . typescript-jsdoc-tag)\n     (\"{LicenseType1} With more text\" . font-lock-comment-face)\n     (\"With more text\" . font-lock-comment-face)\n     (\"more text\" . font-lock-comment-face)\n     (\"text\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/license-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @license tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@license\"\n     )\n   '(\n     ;; (\"@license$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/listens-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @listens tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@listens event:nameOfEvent\"\n     )\n   '(\n     (\"@listens event:nameOfEvent\" . typescript-jsdoc-tag)\n     (\"event:nameOfEvent\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/listens-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @listens tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@listens extra text0\"\n     \"@listens {ListenType0}\"\n     \"@listens {ListenType1} and text1\"\n     )\n   '(\n     (\"@listens extra text0\" . typescript-jsdoc-tag)\n     (\"extra text0\" . typescript-jsdoc-value)\n     ;; (\"text0\" . typescript-jsdoc-value)\n     (\"@listens {ListenType0}\" . typescript-jsdoc-tag)\n     (\"{ListenType0}\" . typescript-jsdoc-value)\n     (\"@listens {ListenType1} and text1\" . typescript-jsdoc-tag)\n     (\"{ListenType1} and text1\" . typescript-jsdoc-value)\n     ;; (\"and text1\" . typescript-jsdoc-value)\n     ;; (\"text1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/listens-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @listens tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@listens\"\n     )\n   '(\n     (\"@listens$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/member-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @member tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@member\"\n     \"@member {MemberType0}\"\n     \"@member memberName0\"\n     \"@member {MemberType1} memberName1\"\n     \"@var\"\n     \"@var {VarType0}\"\n     \"@var varName0\"\n     \"@var {VarType1} varName1\"\n     )\n   '(\n     ;; (\"@member$\" . typescript-jsdoc-tag)\n     (\"@member {MemberType0}\" . typescript-jsdoc-tag)\n     ;; (\"{MemberType0}\" . typescript-jsdoc-type)\n     (\"@member memberName0\" . typescript-jsdoc-tag)\n     (\"memberName0\" . typescript-jsdoc-value)\n     (\"@member {MemberType1} memberName1\" . typescript-jsdoc-tag)\n     ;; (\"{MemberType1} memberName1\" . typescript-jsdoc-type)\n     ;; (\"memberName1\" . typescript-jsdoc-value)\n     ;; (\"@var$\" . typescript-jsdoc-tag)\n     (\"@var {VarType0}\" . typescript-jsdoc-tag)\n     ;; ;; (\"{VarType0}\" . typescript-jsdoc-type)\n     (\"@var varName0\" . typescript-jsdoc-tag)\n     (\"varName0\" . typescript-jsdoc-value)\n     (\"@var {VarType1} varName1\" . typescript-jsdoc-tag)\n     ;; (\"{VarType1} varName1\" . typescript-jsdoc-type)\n     ;; (\"varName1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/member-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @member tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@member extra value0\"\n     \"@var extra value1\"\n     )\n   '(\n     (\"@member extra value0\" . typescript-jsdoc-tag)\n     (\"extra value0\" . typescript-jsdoc-value)\n     (\"value0\" . font-lock-comment-face)\n     (\"@var extra value1\" . typescript-jsdoc-tag)\n     (\"extra value1\" . typescript-jsdoc-value)\n     (\"value1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/member-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @member tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/memberof-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @memberof tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@memberof SomeClass0\"\n     \"@memberof SomeClass1#\"\n     \"@memberof <global>\"\n     \"@memberof! OtherClass0\"\n     \"@memberof! OtherClass1#\"\n     ;; \"@memberof! <global>\" is valid, but it is hard to test.\n     )\n   '(\n     (\"@memberof SomeClass0\" . typescript-jsdoc-tag)\n     (\"SomeClass0\" . typescript-jsdoc-value)\n     (\"@memberof SomeClass1#\" . typescript-jsdoc-tag)\n     (\"SomeClass1#\" . typescript-jsdoc-value)\n     (\"@memberof <global>\" . typescript-jsdoc-tag)\n     (\"<global>\" . typescript-jsdoc-value)\n     ;; (\"@memberof! OtherClass0\" . typescript-jsdoc-tag)\n     ;; (\"OtherClass0\" . typescript-jsdoc-value)\n     ;; (\"@memberof! OtherClass1#\" . typescript-jsdoc-tag)\n     ;; (\"OtherClass1#\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/memberof-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @memberof tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@memberof extra text0\"\n     \"@memberof {MemberOfType0}\"\n     \"@memberof {MemberOfType1} and text1\"\n     \"@memberof! again string0\"\n     \"@memberof! {MemberOfForcedType0}\"\n     \"@memberof! {MemberOfForcedType1} and more string1\"\n     )\n   '(\n     (\"@memberof extra text0\" . typescript-jsdoc-tag)\n     (\"extra text0\" . typescript-jsdoc-value)\n     ;; (\"text0\" . typescript-jsdoc-value)\n     (\"@memberof {MemberOfType0}\" . typescript-jsdoc-tag)\n     (\"{MemberOfType0}\" . typescript-jsdoc-value)\n     (\"@memberof {MemberOfType1} and text1\" . typescript-jsdoc-tag)\n     (\"{MemberOfType1} and text1\" . typescript-jsdoc-value)\n     ;; (\"and text1\" . typescript-jsdoc-value)\n     ;; (\"text1\" . typescript-jsdoc-value)\n     ;; (\"@memberof! again string0\" . typescript-jsdoc-tag)\n     ;; (\"again string0\" . typescript-jsdoc-value)\n     ;; (\"string0\" . typescript-jsdoc-value)\n     ;; (\"@memberof! {MemberOfForcedType0}\" . typescript-jsdoc-tag)\n     ;; (\"{MemberOfForcedType0}\" . typescript-jsdoc-value)\n     ;; (\"@memberof! {MemberOfForcedType1} and more string1\" . typescript-jsdoc-tag)\n     ;; (\"{MemberOfForcedType1} and more string1\" . typescript-jsdoc-value)\n     ;; (\"and more string1\" . typescript-jsdoc-value)\n     ;; (\"more string1\" . typescript-jsdoc-value)\n     ;; (\"string1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/memberof-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @memberof tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@memberof\"\n     \"@memberof!\"\n     )\n   '(\n     (\"@memberof$\" . font-lock-comment-face)\n     (\"@memberof!$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/mixes-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @mixes tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@mixes OtherObject\"\n     )\n   '(\n     (\"@mixes OtherObject\" . typescript-jsdoc-tag)\n     (\"OtherObject\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/mixes-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @mixes tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@mixes extra text0\"\n     \"@mixes {MixesType0}\"\n     \"@mixes {MixesType1} and text1\"\n     )\n   '(\n     (\"@mixes extra text0\" . typescript-jsdoc-tag)\n     (\"extra text0\" . typescript-jsdoc-value)\n     (\"text0\" . font-lock-comment-face)\n     (\"@mixes {MixesType0}\" . typescript-jsdoc-tag)\n     (\"{MixesType0}\" . typescript-jsdoc-value)\n     (\"@mixes {MixesType1} and text1\" . typescript-jsdoc-tag)\n     (\"{MixesType1} and text1\" . typescript-jsdoc-value)\n     (\"and text1\" . font-lock-comment-face)\n     (\"text1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/mixes-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @mixes tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@mixes\"\n     )\n   '(\n     (\"@mixes$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/mixin-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @mixin tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@mixin\"\n     \"@mixin MixinName\"\n     )\n   '(\n     (\"@mixin$\" . typescript-jsdoc-tag)\n     (\"@mixin MixinName\" . typescript-jsdoc-tag)\n     ;; (\"MixinName\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/mixin-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @mixin tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@mixin and extra text0\"\n     \"@mixin {MixinType0}\"\n     \"@mixin {MixinType1} with more text1\"\n     )\n   '(\n     (\"@mixin and extra text0\" . typescript-jsdoc-tag)\n     ;; (\"and extra text0\" . typescript-jsdoc-value)\n     (\"extra text0\" . font-lock-comment-face)\n     (\"text0\" . font-lock-comment-face)\n     (\"@mixin {MixinType0}\" . typescript-jsdoc-tag)\n     ;; (\"{MixinType0}\" . typescript-jsdoc-value)\n     (\"@mixin {MixinType1} with more text1\" . typescript-jsdoc-tag)\n     ;; (\"{MixinType1} with more text1\" . typescript-jsdoc-value)\n     (\"with more text1\" . font-lock-comment-face)\n     (\"more text1\" . font-lock-comment-face)\n     (\"text1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/mixin-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @mixin tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n;; @modified tag is not yet released (It is a new tag of JSDoc 3.6.0)\n(ert-deftest jsdoc/modifies-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @modifies tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@modifies\"\n     \"@modifies {ModifiedType}\"\n     )\n   '(\n     ;; (\"@modifies$\" . typescript-jsdoc-tag)\n     ;; (\"@modifies {ModifiedType}\" . typescript-jsdoc-tag)\n     ;; (\"{ModifiedType}\" . typescript-jsdoc-type)\n     )))\n\n(ert-deftest jsdoc/modifies-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @modifies tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@modifies name0\"\n     \"@modifies {ModifiedType} and name1\"\n     )\n   '(\n     ;; (\"@modifies name0\" . typescript-jsdoc-tag)\n     ;; (\"name0\" . font-lock-comment-face)\n     ;; (\"@modifies {ModifiedType} and name1\" . typescript-jsdoc-tag)\n     ;; (\"{ModifiedType} and name1\" . typescript-jsdoc-type)\n     ;; (\"and name1\" . font-lock-comment-face)\n     ;; (\"name1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/modifies-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @modifies tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@modifies\"\n     )\n   '(\n     (\"@modifies$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/module-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @module tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@module\"\n     \"@module ModuleName0\"\n     \"@module {ModuleType0}\"\n     \"@module {ModuleType1} ModuleName1\"\n     )\n   '(\n     ;; (\"@module$\" . typescript-jsdoc-tag)\n     (\"@module ModuleName0\" . typescript-jsdoc-tag)\n     (\"ModuleName0\" . typescript-jsdoc-value)\n     (\"@module {ModuleType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ModuleType0}\" . typescript-jsdoc-type)\n     (\"@module {ModuleType1} ModuleName1\" . typescript-jsdoc-tag)\n     ;; (\"{ModuleType1} ModuleName1\" . typescript-jsdoc-type)\n     ;; (\"ModuleName1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/module-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @module tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@module with multiple words0\"\n     \"@module {ModuleType} with multiple words1\"\n     )\n   '(\n     (\"@module with multiple words0\" . typescript-jsdoc-tag)\n     (\"with multiple words0\" . typescript-jsdoc-value)\n     (\"multiple words0\" . font-lock-comment-face)\n     (\"words0\" . font-lock-comment-face)\n     (\"@module {ModuleType} with multiple words1\" . typescript-jsdoc-tag)\n     ;; (\"{ModuleType} with multiple words1\" . typescript-jsdoc-type)\n     ;; (\"with multiple words1\" . typescript-jsdoc-value)\n     (\"multiple words1\" . font-lock-comment-face)\n     (\"words1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/module-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @module tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/namespace-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @namespace tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@namespace\"\n     \"@namespace Namespace0\"\n     \"@namespace {NamespaceType0}\"\n     \"@namespace {NamespaceType1} Namespace1\"\n     )\n   '(\n     ;; (\"@namespace$\" . typescript-jsdoc-tag)\n     (\"@namespace Namespace0\" . typescript-jsdoc-tag)\n     (\"Namespace0\" . typescript-jsdoc-value)\n     (\"@namespace {NamespaceType0}\" . typescript-jsdoc-tag)\n     ;; (\"{NamespaceType0}\" . typescript-jsdoc-type)\n     (\"@namespace {NamespaceType1} Namespace1\" . typescript-jsdoc-tag)\n     ;; (\"{NamespaceType1} Namespace1\" . typescript-jsdoc-type)\n     ;; (\"Namespace1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/namespace-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @namespace tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@namespace with multiple words0\"\n     \"@namespace {NamespaceType} with multiple words1\"\n     )\n   '(\n     (\"@namespace with multiple words0\" . typescript-jsdoc-tag)\n     (\"with multiple words0\" . typescript-jsdoc-value)\n     (\"multiple words0\" . font-lock-comment-face)\n     (\"words0\" . font-lock-comment-face)\n     (\"@namespace {NamespaceType} with multiple words1\" . typescript-jsdoc-tag)\n     ;; (\"{NamespaceType} with multiple words1\" . typescript-jsdoc-type)\n     ;; (\"with multiple words1\" . typescript-jsdoc-value)\n     (\"multiple words1\" . font-lock-comment-face)\n     (\"words1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/namespace-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @namespace tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/package-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @package tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@package\"\n     )\n   '(\n     (\"@package$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/package-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @package tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/package-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @package tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@package invalid extra values\"\n     \"@package {InvalidType}\"\n     )\n   '(\n     (\"@package invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@package {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/param-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @param tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@param\"\n     \"@param {ParamType0}\"\n     \"@param paramName0\"\n     \"@param {ParamType1} paramName1\"\n     \"@param {ParamType2} paramName2 with paramDescription2\"\n     \"@arg\"\n     \"@arg {ArgType0}\"\n     \"@arg argName0\"\n     \"@arg {ArgType1} argName1\"\n     \"@arg {ArgType2} argName2 with argDescription2\"\n     \"@argument\"\n     \"@argument {ArgumentType0}\"\n     \"@argument argumentName0\"\n     \"@argument {ArgumentType1} argumentName1\"\n     \"@argument {ArgumentType2} argumentName2 with argumentDescription2\"\n     )\n   '(\n     (\"@param$\" . typescript-jsdoc-tag)\n     (\"@param {ParamType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ParamType0}\" . typescript-jsdoc-type)\n     (\"@param paramName0\" . typescript-jsdoc-tag)\n     (\"paramName0\" . typescript-jsdoc-value)\n     (\"@param {ParamType1} paramName1\" . typescript-jsdoc-tag)\n     (\"{ParamType1} paramName1\" . typescript-jsdoc-type)\n     (\"paramName1\" . typescript-jsdoc-value)\n     (\"@param {ParamType2} paramName2 with paramDescription2\" . typescript-jsdoc-tag)\n     (\"{ParamType2} paramName2 with paramDescription2\" . typescript-jsdoc-type)\n     (\"paramName2 with paramDescription2\" . typescript-jsdoc-value)\n     (\"with paramDescription2\" . font-lock-comment-face)\n     (\"paramDescription2\" . font-lock-comment-face)\n     (\"@arg$\" . typescript-jsdoc-tag)\n     (\"@arg {ArgType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ArgType0}\" . typescript-jsdoc-type)\n     (\"@arg argName0\" . typescript-jsdoc-tag)\n     (\"argName0\" . typescript-jsdoc-value)\n     (\"@arg {ArgType1} argName1\" . typescript-jsdoc-tag)\n     (\"{ArgType1} argName1\" . typescript-jsdoc-type)\n     (\"argName1\" . typescript-jsdoc-value)\n     (\"@arg {ArgType2} argName2 with argDescription2\" . typescript-jsdoc-tag)\n     (\"{ArgType2} argName2 with argDescription2\" . typescript-jsdoc-type)\n     (\"argName2 with argDescription2\" . typescript-jsdoc-value)\n     (\"with argDescription2\" . font-lock-comment-face)\n     (\"argDescription2\" . font-lock-comment-face)\n     (\"@argument$\" . typescript-jsdoc-tag)\n     (\"@argument {ArgumentType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ArgumentType0}\" . typescript-jsdoc-type)\n     (\"@argument argumentName0\" . typescript-jsdoc-tag)\n     (\"argumentName0\" . typescript-jsdoc-value)\n     (\"@argument {ArgumentType1} argumentName1\" . typescript-jsdoc-tag)\n     (\"{ArgumentType1} argumentName1\" . typescript-jsdoc-type)\n     (\"argumentName1\" . typescript-jsdoc-value)\n     (\"@argument {ArgumentType2} argumentName2 with argumentDescription2\" . typescript-jsdoc-tag)\n     (\"{ArgumentType2} argumentName2 with argumentDescription2\" . typescript-jsdoc-type)\n     (\"argumentName2 with argumentDescription2\" . typescript-jsdoc-value)\n     (\"with argumentDescription2\" . font-lock-comment-face)\n     (\"argumentDescription2\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/param-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @param tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@param extra value0\"\n     \"@arg extra value1\"\n     \"@argument extra value2\"\n     )\n   '(\n     (\"@param extra value0\" . typescript-jsdoc-tag)\n     (\"extra value0\" . typescript-jsdoc-value)\n     (\"value0\" . font-lock-comment-face)\n     (\"@arg extra value1\" . typescript-jsdoc-tag)\n     (\"extra value1\" . typescript-jsdoc-value)\n     (\"value1\" . font-lock-comment-face)\n     (\"@argument extra value2\" . typescript-jsdoc-tag)\n     (\"extra value2\" . typescript-jsdoc-value)\n     (\"value2\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/param-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @param tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/private-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @private tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@private\"\n     )\n   '(\n     (\"@private$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/private-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @private tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/private-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @private tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@private invalid extra values\"\n     \"@private {InvalidType}\"\n     )\n   '(\n     (\"@private invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@private {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/property-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @property tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@property {PropertyType0}\"\n     \"@property propertyName0\"\n     \"@property {PropertyType1} propertyName1\"\n     \"@property {PropertyType2} propertyName2 with propertyDescription2\"\n     \"@prop\"\n     \"@prop {PropType0}\"\n     \"@prop propName0\"\n     \"@prop {PropType1} propName1\"\n     \"@prop {PropType2} propName2 with propDescription2\"\n     )\n   '(\n     (\"@property {PropertyType0}\" . typescript-jsdoc-tag)\n     ;; (\"{PropertyType0}\" . typescript-jsdoc-type)\n     (\"@property propertyName0\" . typescript-jsdoc-tag)\n     (\"propertyName0\" . typescript-jsdoc-value)\n     (\"@property {PropertyType1} propertyName1\" . typescript-jsdoc-tag)\n     (\"{PropertyType1} propertyName1\" . typescript-jsdoc-type)\n     (\"propertyName1\" . typescript-jsdoc-value)\n     (\"@property {PropertyType2} propertyName2 with propertyDescription2\" . typescript-jsdoc-tag)\n     (\"{PropertyType2} propertyName2 with propertyDescription2\" . typescript-jsdoc-type)\n     (\"propertyName2 with propertyDescription2\" . typescript-jsdoc-value)\n     (\"with propertyDescription2\" . font-lock-comment-face)\n     (\"propertyDescription2\" . font-lock-comment-face)\n     (\"@prop {PropType0}\" . typescript-jsdoc-tag)\n     ;; (\"{PropType0}\" . typescript-jsdoc-type)\n     (\"@prop propName0\" . typescript-jsdoc-tag)\n     (\"propName0\" . typescript-jsdoc-value)\n     (\"@prop {PropType1} propName1\" . typescript-jsdoc-tag)\n     (\"{PropType1} propName1\" . typescript-jsdoc-type)\n     (\"propName1\" . typescript-jsdoc-value)\n     (\"@prop {PropType2} propName2 with propDescription2\" . typescript-jsdoc-tag)\n     (\"{PropType2} propName2 with propDescription2\" . typescript-jsdoc-type)\n     (\"propName2 with propDescription2\" . typescript-jsdoc-value)\n     (\"with propDescription2\" . font-lock-comment-face)\n     (\"propDescription2\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/property-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @property tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/property-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @property tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@property\"\n     \"@prop\"\n     )\n   '(\n     ;; (\"@property$\" . font-lock-comment-face)\n     ;; (\"@prop$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/protected-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @protected tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@protected\"\n     )\n   '(\n     (\"@protected$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/protected-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @protected tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/protected-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @protected tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@protected invalid extra values\"\n     \"@protected {InvalidType}\"\n     )\n   '(\n     (\"@protected invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@protected {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/public-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @public tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@public\"\n     )\n   '(\n     (\"@public$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/public-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @public tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/public-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @public tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@public invalid extra values\"\n     \"@public {InvalidType}\"\n     )\n   '(\n     (\"@public invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@public {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/readonly-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @readonly tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@readonly\"\n     )\n   '(\n     (\"@readonly$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/readonly-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @readonly tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/readonly-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @readonly tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@readonly invalid extra values\"\n     \"@readonly {InvalidType}\"\n     )\n   '(\n     (\"@readonly invalid extra values\" . typescript-jsdoc-tag)\n     (\"invalid extra values\" . font-lock-comment-face)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@readonly {InvalidType}\" . typescript-jsdoc-tag)\n     (\"{InvalidType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/requires-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @requires tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@requires SomeModuleName\"\n     \"@requires module:path/to/module\"\n     \"@requires {@link something}\"\n     )\n   '(\n     (\"@requires SomeModuleName\" . typescript-jsdoc-tag)\n     (\"SomeModuleName\" . typescript-jsdoc-value)\n     (\"@requires module:path/to/module\" . typescript-jsdoc-tag)\n     (\"module:path/to/module\" . typescript-jsdoc-value)\n     (\"@requires {@link something}\" . typescript-jsdoc-tag)\n     (\"{@link something}\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/requires-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @requires tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@requires extra text0\"\n     \"@requires {RequiresType0}\"\n     \"@requires {RequiresType1} and text1\"\n     )\n   '(\n     (\"@requires extra text0\" . typescript-jsdoc-tag)\n     (\"extra text0\" . typescript-jsdoc-value)\n     (\"text0\" . font-lock-comment-face)\n     (\"@requires {RequiresType0}\" . typescript-jsdoc-tag)\n     (\"{RequiresType0}\" . typescript-jsdoc-value)\n     (\"@requires {RequiresType1} and text1\" . typescript-jsdoc-tag)\n     (\"{RequiresType1} and text1\" . typescript-jsdoc-value)\n     (\"and text1\" . font-lock-comment-face)\n     (\"text1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/requires-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @requires tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@requires\"\n     )\n   '(\n     ;; (\"@requires$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/returns-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @returns tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@returns description for returned value0\"\n     \"@returns {ReturnType1} description for returned value1\"\n     \"@return description for returned value2\"\n     \"@return {ReturnType3} description for returned value3\"\n     )\n   '(\n     (\"@returns description for returned value0\" . typescript-jsdoc-tag)\n     (\"description for returned value0\" . font-lock-comment-face)\n     (\"for returned value0\" . font-lock-comment-face)\n     (\"returned value0\" . font-lock-comment-face)\n     (\"value0\" . font-lock-comment-face)\n     (\"@returns {ReturnType1} description for returned value1\" . typescript-jsdoc-tag)\n     (\"{ReturnType1} description for returned value1\" . typescript-jsdoc-type)\n     (\"description for returned value1\" . font-lock-comment-face)\n     (\"for returned value1\" . font-lock-comment-face)\n     (\"returned value1\" . font-lock-comment-face)\n     (\"value1\" . font-lock-comment-face)\n     (\"@return description for returned value2\" . typescript-jsdoc-tag)\n     (\"description for returned value2\" . font-lock-comment-face)\n     (\"for returned value2\" . font-lock-comment-face)\n     (\"returned value2\" . font-lock-comment-face)\n     (\"value2\" . font-lock-comment-face)\n     (\"@return {ReturnType3} description for returned value3\" . typescript-jsdoc-tag)\n     (\"{ReturnType3} description for returned value3\" . typescript-jsdoc-type)\n     (\"description for returned value3\" . font-lock-comment-face)\n     (\"for returned value3\" . font-lock-comment-face)\n     (\"returned value3\" . font-lock-comment-face)\n     (\"value3\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/returns-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @returns tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/returns-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @returns tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@returns\"\n     \"@return\"\n     )\n   '(\n     ;; (\"@returns$\" . font-lock-comment-face)\n     ;; (\"@return$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/see-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @see tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@see someName.path\"\n     \"@see {@link something}\"\n     \"@see any other text\"\n     )\n   '(\n     ;; (\"@see someName.path\" . typescript-jsdoc-tag)\n     ;; (\"someName.path\" . typescript-jsdoc-value)\n     ;; (\"@see {@link something}\" . typescript-jsdoc-tag)\n     ;; (\"{@link something}\" . typescript-jsdoc-value)\n     ;; (\"@see any other text\" . typescript-jsdoc-tag)\n     ;; (\"any other text\" . typescript-jsdoc-value)\n     ;; (\"other text\" . typescript-jsdoc-value)\n     ;; (\"text\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/see-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @see tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@see {SeeType0}\"\n     \"@see {SeeType1} and text1\"\n     )\n   '(\n     ;; (\"@see {SeeType0}\" . typescript-jsdoc-tag)\n     ;; (\"{SeeType0}\" . typescript-jsdoc-value)\n     ;; (\"@see {SeeType1} and text1\" . typescript-jsdoc-tag)\n     ;; (\"{SeeType1} and text1\" . typescript-jsdoc-value)\n     ;; (\"and text1\" . typescript-jsdoc-value)\n     ;; (\"text1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/see-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @see tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@see\"\n     )\n   '(\n     (\"@see$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/since-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @since tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@since 1.0.1\"\n     )\n   '(\n     (\"@since 1.0.1\" . typescript-jsdoc-tag)\n     (\"1.0.1\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/since-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @since tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@since some extra text0\"\n     \"@since {SinceType0}\"\n     \"@since {SinceType1} and text1\"\n     )\n   '(\n     (\"@since some extra text0\" . typescript-jsdoc-tag)\n     (\"some extra text0\" . typescript-jsdoc-value)\n     (\"extra text0\" . font-lock-comment-face)\n     (\"text0\" . font-lock-comment-face)\n     (\"@since {SinceType0}\" . typescript-jsdoc-tag)\n     (\"{SinceType0}\" . typescript-jsdoc-value)\n     (\"@since {SinceType1} and text1\" . typescript-jsdoc-tag)\n     (\"{SinceType1} and text1\" . typescript-jsdoc-value)\n     (\"and text1\" . font-lock-comment-face)\n     (\"text1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/since-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @since tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@since\"\n     )\n   '(\n     (\"@since$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/static-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @static tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@static\"\n     )\n   '(\n     (\"@static$\" . typescript-jsdoc-tag)\n     )))\n\n(ert-deftest jsdoc/static-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @static tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@static extra values\"\n     \"@static {StaticType}\"\n     )\n   '(\n     (\"@static extra values\" . typescript-jsdoc-tag)\n     (\"extra values\" . font-lock-comment-face)\n     (\"values\" . font-lock-comment-face)\n     (\"@static {StaticType}\" . typescript-jsdoc-tag)\n     (\"{StaticType}\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/static-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @static tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/summary-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @summary tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@summary some summary text\"\n     )\n   '(\n     (\"@summary some summary text\" . typescript-jsdoc-tag)\n     (\"some summary text\" . font-lock-comment-face)\n     (\"summary text\" . font-lock-comment-face)\n     (\"text\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/summary-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @summary tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@summary {SummaryType0}\"\n     \"@summary {SummaryType1} and text1\"\n     )\n   '(\n     (\"@summary {SummaryType0}\" . typescript-jsdoc-tag)\n     (\"{SummaryType0}\" . font-lock-comment-face)\n     (\"@summary {SummaryType1} and text1\" . typescript-jsdoc-tag)\n     (\"{SummaryType1} and text1\" . font-lock-comment-face)\n     (\"and text1\" . font-lock-comment-face)\n     (\"text1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/summary-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @summary tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@summary\"\n     )\n   '(\n     ;; (\"@summary$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/this-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @this tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@this ClassForThis\"\n     )\n   '(\n     (\"@this ClassForThis\" . typescript-jsdoc-tag)\n     (\"ClassForThis\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/this-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @this tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@this and multiple words0\"\n     \"@this {SummaryType0}\"\n     \"@this {SummaryType1} and multiple words1\"\n     )\n   '(\n     (\"@this and multiple words0\" . typescript-jsdoc-tag)\n     (\"and multiple words0\" . typescript-jsdoc-value)\n     (\"multiple words0\" . font-lock-comment-face)\n     (\"words0\" . font-lock-comment-face)\n     (\"@this {SummaryType0}\" . typescript-jsdoc-tag)\n     (\"{SummaryType0}\" . typescript-jsdoc-value)\n     (\"@this {SummaryType1} and multiple words1\" . typescript-jsdoc-tag)\n     (\"{SummaryType1} and multiple words1\" . typescript-jsdoc-value)\n     (\"and multiple words1\" . font-lock-comment-face)\n     (\"multiple words1\" . font-lock-comment-face)\n     (\"words1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/this-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @this tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@this\"\n     )\n   '(\n     (\"@this$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/todo-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @todo tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@todo todo things\"\n     \"@todo more things to do!\"\n     )\n   '(\n     (\"@todo todo things\" . typescript-jsdoc-tag)\n     (\"todo things\" . font-lock-comment-face)\n     (\"things\" . font-lock-comment-face)\n     (\"@todo more things to do!\" . typescript-jsdoc-tag)\n     (\"more things to do!\" . font-lock-comment-face)\n     (\"things to do!\" . font-lock-comment-face)\n     (\"to do!\" . font-lock-comment-face)\n     (\"do!\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/todo-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @todo tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@todo {TodoType0}\"\n     \"@todo {TodoType1} and text1\"\n     )\n   '(\n     (\"@todo {TodoType0}\" . typescript-jsdoc-tag)\n     (\"{TodoType0}\" . font-lock-comment-face)\n     (\"@todo {TodoType1} and text1\" . typescript-jsdoc-tag)\n     (\"{TodoType1} and text1\" . font-lock-comment-face)\n     (\"and text1\" . font-lock-comment-face)\n     (\"text1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/todo-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @todo tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@todo\"\n     )\n   '(\n     ;; (\"@todo$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/throws-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @throws tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@throws explanation for throws cases0\"\n     \"@throws {ThrowsType0}\"\n     \"@throws {ThrowsType1} explanation for throws cases1\"\n     \"@exception explanation for exception0\"\n     \"@exception {ExceptionType0}\"\n     \"@exception {ExceptionType1} explanation for exception1\"\n     )\n   '(\n     (\"@throws explanation for throws cases0\" . typescript-jsdoc-tag)\n     ;; (\"explanation for throws cases0\" . font-lock-comment-face)\n     (\"for throws cases0\" . font-lock-comment-face)\n     (\"throws cases0\" . font-lock-comment-face)\n     (\"cases0\" . font-lock-comment-face)\n     (\"@throws {ThrowsType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ThrowsType0}\" . typescript-jsdoc-type)\n     (\"@throws {ThrowsType1} explanation for throws cases1\" . typescript-jsdoc-tag)\n     ;; (\"{ThrowsType1} explanation for throws cases1\" . typescript-jsdoc-type)\n     (\"explanation for throws cases1\" . font-lock-comment-face)\n     (\"for throws cases1\" . font-lock-comment-face)\n     (\"throws cases1\" . font-lock-comment-face)\n     (\"cases1\" . font-lock-comment-face)\n     (\"@exception explanation for exception0\" . typescript-jsdoc-tag)\n     ;; (\"explanation for exception0\" . font-lock-comment-face)\n     (\"for exception0\" . font-lock-comment-face)\n     (\"exception0\" . font-lock-comment-face)\n     (\"@exception {ExceptionType0}\" . typescript-jsdoc-tag)\n     ;; (\"{ExceptionType0}\" . typescript-jsdoc-type)\n     (\"@exception {ExceptionType1} explanation for exception1\" . typescript-jsdoc-tag)\n     ;; (\"{ExceptionType1} explanation for exception1\" . typescript-jsdoc-type)\n     (\"explanation for exception1\" . font-lock-comment-face)\n     (\"for exception1\" . font-lock-comment-face)\n     (\"exception1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/throws-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @throws tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/throws-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @throws tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@throws\"\n     \"@exception\"\n     )\n   '(\n     ;; (\"@throws$\" . font-lock-comment-face)\n     ;; (\"@exception$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/tutorial-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @tutorial tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@tutorial tutorial-file0\"\n     )\n   '(\n     (\"@tutorial tutorial-file0\" . typescript-jsdoc-tag)\n     ;; (\"tutorial-file0\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/tutorial-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @tutorial tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@tutorial multiple words0\"\n     \"@tutorial {TutorialType0}\"\n     \"@tutorial {TutorialType1} multiple words1\"\n     )\n   '(\n     (\"@tutorial multiple words0\" . typescript-jsdoc-tag)\n     ;; (\"multiple words0\" . typescript-jsdoc-value)\n     (\"words0\" . font-lock-comment-face)\n     (\"@tutorial {TutorialType0}\" . typescript-jsdoc-tag)\n     ;; (\"{TutorialType0}\" . typescript-jsdoc-value)\n     (\"@tutorial {TutorialType1} multiple words1\" . typescript-jsdoc-tag)\n     ;; (\"{TutorialType1} multiple words1\" . typescript-jsdoc-value)\n     (\"multiple words1\" . font-lock-comment-face)\n     (\"words1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/tutorial-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @tutorial tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@tutorial\"\n     )\n   '(\n     ;; (\"@tutorial$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/type-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @type tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@type TypeOfSomething0\"\n     \"@type {TypeofSomething1}\"\n     )\n   '(\n     (\"@type TypeOfSomething0\" . typescript-jsdoc-tag)\n     ;; (\"TypeOfSomething0\" . typescript-jsdoc-type)\n     (\"@type {TypeOfSomething1}\" . typescript-jsdoc-tag)\n     (\"{TypeOfSomething1}\" . typescript-jsdoc-type)\n     )))\n\n(ert-deftest jsdoc/type-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @type tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@type multiple words0\"\n     \"@type {Type0} multiple words1\"\n     )\n   '(\n     (\"@type multiple words0\" . typescript-jsdoc-tag)\n     ;; (\"multiple words0\" . typescript-jsdoc-type)\n     (\"words0\" . font-lock-comment-face)\n     (\"@type {Type0} multiple words1\" . typescript-jsdoc-tag)\n     (\"{Type0} multiple words1\" . typescript-jsdoc-type)\n     (\"multiple words1\" . font-lock-comment-face)\n     (\"words1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/type-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @type tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@type\"\n     )\n   '(\n     ;; (\"@type$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/typedef-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @typedef tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@typedef nameOfNewType0\"\n     \"@typedef namePath~OfNewType0\"\n     \"@typedef {TypeOfNewType0} nameOfNewType1\"\n     \"@typedef {TypeOfNewType1} namePath~OfNewType1\"\n     \"@callback nameOfNewCallback\"\n     \"@callback namePath~OfNewCallback\"\n     )\n   '(\n     (\"@typedef nameOfNewType0\" . typescript-jsdoc-tag)\n     (\"nameOfNewType0\" . typescript-jsdoc-value)\n     (\"@typedef namePath~OfNewType0\" . typescript-jsdoc-tag)\n     (\"namePath~OfNewType0\" . typescript-jsdoc-value)\n     (\"OfNewType0\" . typescript-jsdoc-value)\n     (\"@typedef {TypeOfNewType0} nameOfNewType1\" . typescript-jsdoc-tag)\n     (\"{TypeOfNewType0} nameOfNewType1\" . typescript-jsdoc-type)\n     (\"nameOfNewType1\" . typescript-jsdoc-value)\n     (\"@typedef {TypeOfNewType1} namePath~OfNewType1\" . typescript-jsdoc-tag)\n     (\"{TypeOfNewType1} namePath~OfNewType1\" . typescript-jsdoc-type)\n     (\"namePath~OfNewType1\" . typescript-jsdoc-value)\n     (\"OfNewType1\" . typescript-jsdoc-value)\n     (\"@callback nameOfNewCallback\" . typescript-jsdoc-tag)\n     (\"nameOfNewCallback\" . typescript-jsdoc-value)\n     (\"@callback namePath~OfNewCallback\" . typescript-jsdoc-tag)\n     (\"namePath~OfNewCallback\" . typescript-jsdoc-value)\n     (\"OfNewCallback\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/typedef-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @typedef tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@typedef\"\n     \"@typedef multiple words0\"\n     \"@typedef {TypeOfNewType0}\"\n     \"@typedef {TypeOfNewType1} multiple words1\"\n     \"@callback\"\n     \"@callback multiple words for callback0\"\n     \"@callback {CallbackType0}\"\n     \"@callback {CallbackType1} nameOfNewCallback\"\n     \"@callback {CallbackType2} namePath~OfNewCallback\"\n     \"@callback {CallbackType3} multiple words for callback1\"\n     )\n   '(\n     (\"@typedef$\" . typescript-jsdoc-tag)\n     (\"@typedef multiple words0\" . typescript-jsdoc-tag)\n     (\"multiple words0\" . typescript-jsdoc-value)\n     (\"words0\" . font-lock-comment-face)\n     (\"@typedef {TypeOfNewType0}\" . typescript-jsdoc-tag)\n     ;; (\"{TypeOfNewType0}\" . typescript-jsdoc-type)\n     (\"@typedef {TypeOfNewType1} multiple words1\" . typescript-jsdoc-tag)\n     (\"{TypeOfNewType1} multiple words1\" . typescript-jsdoc-type)\n     (\"multiple words1\" . typescript-jsdoc-value)\n     (\"words1\" . font-lock-comment-face)\n     ;; (\"@callback$\" . typescript-jsdoc-tag)\n     (\"@callback multiple words for callback0\" . typescript-jsdoc-tag)\n     (\"multiple words for callback0\" . typescript-jsdoc-value)\n     (\"words for callback0\" . font-lock-comment-face)\n     (\"for callback0\" . font-lock-comment-face)\n     (\"callback0\" . font-lock-comment-face)\n     (\"@callback {CallbackType0}\" . typescript-jsdoc-tag)\n     ;; (\"{CallbackType0}\" . typescript-jsdoc-type)\n     (\"@callback {CallbackType1} nameOfNewCallback\" . typescript-jsdoc-tag)\n     ;; (\"{CallbackType1} nameOfNewCallback\" . typescript-jsdoc-type)\n     ;; (\"nameOfNewCallback\" . typescript-jsdoc-value)\n     (\"@callback {CallbackType2} namePath~OfNewCallback\" . typescript-jsdoc-tag)\n     ;; (\"{CallbackType2} namePath~OfNewCallback\" . typescript-jsdoc-type)\n     ;; (\"namePath~OfNewCallback\" . typescript-jsdoc-value)\n     ;; (\"OfNewCallback\" . typescript-jsdoc-value)\n     (\"@callback {CallbackType3} multiple words for callback1\" . typescript-jsdoc-tag)\n     ;; (\"{CallbackType3} multiple words for callback1\" . typescript-jsdoc-type)\n     ;; (\"multiple words for callback1\" . typescript-jsdoc-value)\n     (\"words for callback1\" . font-lock-comment-face)\n     (\"for callback1\" . font-lock-comment-face)\n     (\"callback1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/typedef-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @typedef tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/variation-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @variation tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@variation 0\"\n     \"@variation (1)\"\n     )\n   '(\n     (\"@variation 0\" . typescript-jsdoc-tag)\n     (\"0\" . typescript-jsdoc-value)\n     (\"@variation (1)\" . typescript-jsdoc-tag)\n     (\"(1)\" . typescript-jsdoc-value)\n     (\"1)\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/variation-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @variation tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@variation multiple words0\"\n     \"@variation {VariationType0}\"\n     \"@variation {VariationType1} multiple words1\"\n     )\n   '(\n     (\"@variation multiple words0\" . typescript-jsdoc-tag)\n     (\"multiple words0\" . typescript-jsdoc-value)\n     (\"words0\" . font-lock-comment-face)\n     (\"@variation {VariationType0}\" . typescript-jsdoc-tag)\n     (\"{VariationType0}\" . typescript-jsdoc-value)\n     (\"@variation {VariationType1} multiple words1\" . typescript-jsdoc-tag)\n     (\"{VariationType1} multiple words1\" . typescript-jsdoc-value)\n     (\"multiple words1\" . font-lock-comment-face)\n     (\"words1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/variation-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @variation tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@variation\"\n     )\n   '(\n     (\"@variation$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/version-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @version tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@version 1.2.3\"\n     \"@version (4.7.1)\"\n     )\n   '(\n     (\"@version 1.2.3\" . typescript-jsdoc-tag)\n     (\"1.2.3\" . typescript-jsdoc-value)\n     (\"2.3\" . typescript-jsdoc-value)\n     (\"3\" . typescript-jsdoc-value)\n     (\"@version (4.7.1)\" . typescript-jsdoc-tag)\n     (\"(4.7.1)\" . typescript-jsdoc-value)\n     (\"7.1)\" . typescript-jsdoc-value)\n     (\"1)\" . typescript-jsdoc-value)\n     )))\n\n(ert-deftest jsdoc/version-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @version tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@version multiple words0\"\n     \"@version {VersionType0}\"\n     \"@version {VersionType1} multiple words1\"\n     )\n   '(\n     (\"@version multiple words0\" . typescript-jsdoc-tag)\n     (\"multiple words0\" . typescript-jsdoc-value)\n     (\"words0\" . font-lock-comment-face)\n     (\"@version {VersionType0}\" . typescript-jsdoc-tag)\n     (\"{VersionType0}\" . typescript-jsdoc-value)\n     (\"@version {VersionType1} multiple words1\" . typescript-jsdoc-tag)\n     (\"{VersionType1} multiple words1\" . typescript-jsdoc-value)\n     (\"multiple words1\" . font-lock-comment-face)\n     (\"words1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/version-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @version tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@version\"\n     )\n   '(\n     (\"@version$\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/yields-tag-in-multiline-doc-comment-with-meaningful-cases ()\n  \"Test for meaningful and valid usage of @yields tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@yields Text for yields0\"\n     \"@yields {YieldsType0}\"\n     \"@yields {YieldsType1} Text for yields1\"\n     \"@yield Text for yield0\"\n     \"@yield {YieldType0}\"\n     \"@yield {YieldType1} Text for yield1\"\n     )\n   '(\n     (\"@yields Text for yields0\" . typescript-jsdoc-tag)\n     (\"Text for yields0\" . font-lock-comment-face)\n     (\"for yields0\" . font-lock-comment-face)\n     (\"yields0\" . font-lock-comment-face)\n     (\"@yields {YieldsType0}\" . typescript-jsdoc-tag)\n     (\"{YieldsType0}\" . typescript-jsdoc-type)\n     (\"@yields {YieldsType1} Text for yields1\" . typescript-jsdoc-tag)\n     (\"{YieldsType1} Text for yields1\" . typescript-jsdoc-type)\n     (\"Text for yields1\" . font-lock-comment-face)\n     (\"for yields1\" . font-lock-comment-face)\n     (\"yields1\" . font-lock-comment-face)\n     (\"@yield Text for yield0\" . typescript-jsdoc-tag)\n     (\"Text for yield0\" . font-lock-comment-face)\n     (\"for yield0\" . font-lock-comment-face)\n     (\"yield0\" . font-lock-comment-face)\n     (\"@yield {YieldType0}\" . typescript-jsdoc-tag)\n     (\"{YieldType0}\" . typescript-jsdoc-type)\n     (\"@yield {YieldType1} Text for yield1\" . typescript-jsdoc-tag)\n     (\"{YieldType1} Text for yield1\" . typescript-jsdoc-type)\n     (\"Text for yield1\" . font-lock-comment-face)\n     (\"for yield1\" . font-lock-comment-face)\n     (\"yield1\" . font-lock-comment-face)\n     )))\n\n(ert-deftest jsdoc/yields-tag-in-multiline-doc-comment-with-meaningless-cases ()\n  \"Test for meaningless though valid usage of @yields tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     )\n   '(\n     )))\n\n(ert-deftest jsdoc/yields-tag-in-multiline-doc-comment-with-invalid-cases ()\n  \"Test for invalid usage of @yields tags and its alias.\"\n  (jsdoc-multiline-test\n   '(\n     \"@yields\"\n     )\n   '(\n     ;; (\"@yields$\" . font-lock-comment-face)\n     )))\n\n;; Do we need to add closure tags?\n;; See https://github.com/jsdoc3/jsdoc/blob/b21427343c7294bbf1f14c718a390f3e955e37cb/lib/jsdoc/tag/dictionary/definitions.js#L870-L1031\n\n(provide 'typescript-mode-jsdoc-tests)\n;;; typescript-mode-jsdoc-tests.el ends here\n"
  },
  {
    "path": "typescript-mode-lexical-binding-tests.el",
    "content": ";; -*- lexical-binding: t -*-\n;;; typescript-mode-lexical-binding-tests --- This file contains test for typescript-mode.el under enabled lexical-binding\n\n;;; Commentary:\n;; To know how to run the tests, see typescript-mode-tests.el\n\n(require 'ert)\n\n;; reload typescript-mode with lexical-binding enabled\n(with-temp-buffer\n  (insert-file-contents \"typescript-mode.el\")\n  (ignore-errors\n    (while (setq sexp (read (current-buffer)))\n      (eval sexp t))))\n\n(require 'typescript-mode-test-utilities)\n\n(ert-deftest lexical-binding--indentation-does-not-throw-error ()\n  (with-temp-buffer\n    (insert-file-contents \"test-files/indentation-reference-document.ts\")\n    (typescript-mode)\n    (goto-line 2)\n    (typescript-indent-line)))\n\n(provide 'typescript-mode-lexical-binding-tests)\n"
  },
  {
    "path": "typescript-mode-test-utilities.el",
    "content": ";;; typescript-mode-test-utilities --- This file contains test utilities for typescript-mode.el\n\n;;; Commentary:\n;; See typescript-mode-tests.el and typescript-mode-jsdoc-tests.el\n\n;;; Code:\n\n(require 'ert)\n(require 'typescript-mode)\n\n;; Adapted from jdee-mode's test suite.\n(defmacro test-with-temp-buffer (content &rest body)\n  \"Fill a temporary buffer with `CONTENT' and eval `BODY' in it.\"\n  (declare (debug t)\n           (indent 1))\n  `(with-temp-buffer\n     (insert ,content)\n     (typescript-mode)\n     (goto-char (point-min))\n     ;; We need this so that tests that simulate user actions operate on the right buffer.\n     (switch-to-buffer (current-buffer))\n     ,@body))\n\n(defmacro test-with-fontified-buffer (content &rest body)\n  \"Fill a temporary buffer with `CONTENT' and eval `BODY' in it.\"\n  (declare (debug t)\n           (indent 1))\n  `(test-with-temp-buffer\n       ,content\n     (font-lock-ensure (point-min) (point-max))\n     ,@body))\n\n(defun get-face-at (loc)\n  \"Get the face at `LOC'.\nIf it is not a number, then we `re-search-forward' with `LOC'\nas the search pattern.\"\n  (when (not (numberp loc))\n    (save-excursion\n      (re-search-forward loc)\n      (setq loc (match-beginning 0))))\n  (get-text-property loc 'face))\n\n(defun font-lock-test (contents expected)\n  \"Perform a test on our template.\n`CONTENTS' is the string to put in the temporary buffer.\n`EXPECTED' is the expected results.\nIt should be a list of (LOCATION . FACE) pairs, where\nLOCATION can be either a single location, or list of locations,\nthat are all expected to have the same face.\"\n  (test-with-fontified-buffer\n      contents\n    ;; Make sure our propertize function has been applied to the whole\n    ;; buffer.\n    (syntax-propertize (point-max))\n    (dolist (spec expected)\n      (if (listp (car spec))\n          (dolist (source (car spec))\n            (should (eq (get-face-at source) (cdr spec))))\n        (should (eq (get-face-at (car spec)) (cdr spec)))))))\n\n(provide 'typescript-mode-test-utilities)\n\n;;; typescript-mode-test-utilities.el ends here\n"
  },
  {
    "path": "typescript-mode-tests.el",
    "content": ";;; typescript-mode-tests --- This file contains automated tests for typescript-mode.el\n\n;;; Commentary:\n;; Run tests using (ert-run-tests-interactively t).\n\n;;; Code:\n\n(require 'ert)\n(require 'typescript-mode)\n(require 'cl-lib)\n(require 'typescript-mode-test-utilities)\n(require 'typescript-mode-general-tests)\n(require 'typescript-mode-jsdoc-tests)\n(require 'typescript-mode-lexical-binding-tests)\n\n(provide 'typescript-mode-tests)\n\n;;; typescript-mode-tests.el ends here\n"
  },
  {
    "path": "typescript-mode.el",
    "content": ";;; typescript-mode.el --- Major mode for editing typescript  -*- lexical-binding: t -*-\n\n;; -----------------------------------------------------------------------------------\n;;     TypeScript support for Emacs\n;;     Unmodified original sourve available at http://www.karllandstrom.se/downloads/emacs/javascript.el\n;;     Copyright (c) 2008-2025 Free Software Foundation\n;;     Portions Copyright (C) Microsoft Open Technologies, Inc. All rights reserved.\n;;\n;;     This program is free software: you can redistribute it and/or modify\n;;     it under the terms of the GNU General Public License as published by\n;;     the Free Software Foundation, either version 3 of the License, or\n;;     (at your option) any later version.\n;;\n;;     This program is distributed in the hope that it will be useful,\n;;     but WITHOUT ANY WARRANTY; without even the implied warranty of\n;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n;;     GNU General Public License for more details.\n;;\n;;     You should have received a copy of the GNU General Public License\n;;     along with this program.  If not, see <http://www.gnu.org/licenses/>.\n;; -------------------------------------------------------------------------------------------\n\n;; URL: http://github.com/ananthakumaran/typescript.el\n;; Version: 0.4\n;; Keywords: typescript languages\n;; Package-Requires: ((emacs \"24.3\"))\n\n;; This file is not part of GNU Emacs.\n\n;;; Commentary:\n\n;; This is based on Karl Landstrom's barebones typescript-mode.  This\n;; is much more robust and works with cc-mode's comment filling\n;; (mostly).\n;; The modifications to the original javascript.el mode mainly consisted in\n;; replacing \"javascript\" with \"typescript\"\n;;\n;; The main features of this typescript mode are syntactic\n;; highlighting (enabled with `font-lock-mode' or\n;; `global-font-lock-mode'), automatic indentation and filling of\n;; comments.\n;;\n;;\n;; General Remarks:\n;;\n;; XXX: This mode assumes that block comments are not nested inside block\n;; XXX: comments\n;;\n;; Exported names start with \"typescript-\"; private names start with\n;; \"typescript--\".\n\n;;; Code:\n\n(eval-and-compile\n  (require 'compile)\n  (require 'cc-mode)\n  (require 'font-lock)\n  (require 'rx)\n  (require 'newcomment))\n\n(eval-when-compile\n  (require 'cl-lib))\n\n;;; Constants\n\n(defconst typescript--type-name-re \"\\\\(?:[A-Z][A-Za-z0-9]+\\\\.\\\\)\\\\{0,\\\\}\\\\(?:[A-Z][A-Za-z0-9]+\\\\)\"\n  \"Regexp matching a conventional TypeScript type-name.  Must start with upper-case letter!\")\n\n(defconst typescript--name-start-re \"[a-zA-Z_$]\"\n  \"Regexp matching the start of a typescript identifier, without grouping.\")\n\n(defconst typescript--name-re (concat typescript--name-start-re\n                              \"\\\\(?:\\\\s_\\\\|\\\\sw\\\\)*\")\n  \"Regexp matching a typescript identifier, without grouping.\")\n\n(defconst typescript--objfield-re (concat typescript--name-re \":\")\n  \"Regexp matching the start of a typescript object field.\")\n\n(defconst typescript--dotted-name-re\n  (concat typescript--name-re \"\\\\(?:\\\\.\" typescript--name-re \"\\\\)*\")\n  \"Regexp matching a dot-separated sequence of typescript names.\")\n\n(defconst typescript--plain-method-re\n  (concat \"^\\\\s-*?\\\\(\" typescript--dotted-name-re \"\\\\)\\\\.prototype\"\n          \"\\\\.\\\\(\" typescript--name-re \"\\\\)\\\\s-*?=\\\\s-*?\\\\(function\\\\)\\\\_>\")\n  \"Regexp matching an explicit typescript prototype \\\"method\\\" declaration.\nGroup 1 is a (possibly-dotted) class name, group 2 is a method name,\nand group 3 is the 'function' keyword.\")\n\n(defconst typescript--plain-class-re\n  (concat \"^\\\\s-*\\\\(\" typescript--dotted-name-re \"\\\\)\\\\.prototype\"\n          \"\\\\s-*=\\\\s-*{\")\n  \"Regexp matching a typescript explicit prototype \\\"class\\\" declaration.\nAn example of this is \\\"Class.prototype = { method1: ...}\\\".\")\n\n(defconst typescript--module-declaration-re\n  \"^\\\\s-*\\\\(?:declare\\\\|\\\\(?:export\\\\(?:\\\\s-+default\\\\)?\\\\)\\\\)?\"\n  \"Regexp matching ambient declaration modifier or export declaration.\")\n\n;; var NewClass = BaseClass.extend(\n(defconst typescript--mp-class-decl-re\n  (concat \"^\\\\s-*var\\\\s-+\"\n          \"\\\\(\" typescript--name-re \"\\\\)\"\n          \"\\\\s-*=\\\\s-*\"\n          \"\\\\(\" typescript--dotted-name-re\n          \"\\\\)\\\\.extend\\\\(?:Final\\\\)?\\\\s-*(\\\\s-*{?\\\\s-*$\"))\n\n;; var NewClass = Class.create()\n(defconst typescript--prototype-obsolete-class-decl-re\n  (concat \"^\\\\s-*\\\\(?:var\\\\s-+\\\\)?\"\n          \"\\\\(\" typescript--dotted-name-re \"\\\\)\"\n          \"\\\\s-*=\\\\s-*Class\\\\.create()\"))\n\n(defconst typescript--prototype-objextend-class-decl-re-1\n  (concat \"^\\\\s-*Object\\\\.extend\\\\s-*(\"\n          \"\\\\(\" typescript--dotted-name-re \"\\\\)\"\n          \"\\\\s-*,\\\\s-*{\"))\n\n(defconst typescript--prototype-objextend-class-decl-re-2\n  (concat \"^\\\\s-*\\\\(?:var\\\\s-+\\\\)?\"\n          \"\\\\(\" typescript--dotted-name-re \"\\\\)\"\n          \"\\\\s-*=\\\\s-*Object\\\\.extend\\\\s-*\\(\"))\n\n;; var NewClass = Class.create({\n(defconst typescript--prototype-class-decl-re\n  (concat \"^\\\\s-*\\\\(?:var\\\\s-+\\\\)?\"\n          \"\\\\(\" typescript--name-re \"\\\\)\"\n          \"\\\\s-*=\\\\s-*Class\\\\.create\\\\s-*(\\\\s-*\"\n          \"\\\\(?:\\\\(\" typescript--dotted-name-re \"\\\\)\\\\s-*,\\\\s-*\\\\)?{?\"))\n\n;; Parent class name(s) (yes, multiple inheritance in typescript) are\n;; matched with dedicated font-lock matchers\n(defconst typescript--dojo-class-decl-re\n  (concat \"^\\\\s-*dojo\\\\.declare\\\\s-*(\\\"\\\\(\" typescript--dotted-name-re \"\\\\)\"))\n\n(defconst typescript--exttypescript-class-decl-re-1\n  (concat \"^\\\\s-*Ext\\\\.extend\\\\s-*(\"\n          \"\\\\s-*\\\\(\" typescript--dotted-name-re \"\\\\)\"\n          \"\\\\s-*,\\\\s-*\\\\(\" typescript--dotted-name-re \"\\\\)\")\n  \"Regexp matching an ExtTYPESCRIPT class declaration (style 1).\")\n\n(defconst typescript--exttypescript-class-decl-re-2\n  (concat \"^\\\\s-*\\\\(?:var\\\\s-+\\\\)?\"\n          \"\\\\(\" typescript--name-re \"\\\\)\"\n          \"\\\\s-*=\\\\s-*Ext\\\\.extend\\\\s-*(\\\\s-*\"\n          \"\\\\(\" typescript--dotted-name-re \"\\\\)\")\n  \"Regexp matching an ExtTYPESCRIPT class declaration (style 2).\")\n\n(defconst typescript--mochikit-class-re\n  (concat \"^\\\\s-*MochiKit\\\\.Base\\\\.update\\\\s-*(\\\\s-*\"\n          \"\\\\(\" typescript--dotted-name-re \"\\\\)\")\n  \"Regexp matching a MochiKit class declaration.\")\n\n(defconst typescript--dummy-class-style\n  '(:name \"[Automatically Generated Class]\"))\n\n(defconst typescript--class-styles\n  `((:name            \"Plain\"\n     :class-decl      ,typescript--plain-class-re\n     :prototype       t\n     :contexts        (toplevel)\n     :framework       typescript)\n\n    (:name            \"MochiKit\"\n     :class-decl      ,typescript--mochikit-class-re\n     :prototype       t\n     :contexts        (toplevel)\n     :framework       mochikit)\n\n    (:name            \"Prototype (Obsolete)\"\n     :class-decl      ,typescript--prototype-obsolete-class-decl-re\n     :contexts        (toplevel)\n     :framework       prototype)\n\n    (:name            \"Prototype (Modern)\"\n     :class-decl      ,typescript--prototype-class-decl-re\n     :contexts        (toplevel)\n     :framework       prototype)\n\n    (:name            \"Prototype (Object.extend)\"\n     :class-decl      ,typescript--prototype-objextend-class-decl-re-1\n     :prototype       t\n     :contexts        (toplevel)\n     :framework       prototype)\n\n    (:name            \"Prototype (Object.extend) 2\"\n     :class-decl      ,typescript--prototype-objextend-class-decl-re-2\n     :prototype       t\n     :contexts        (toplevel)\n     :framework       prototype)\n\n    (:name            \"Dojo\"\n     :class-decl      ,typescript--dojo-class-decl-re\n     :contexts        (toplevel)\n     :framework       dojo)\n\n    (:name            \"ExtTYPESCRIPT (style 1)\"\n     :class-decl      ,typescript--exttypescript-class-decl-re-1\n     :prototype       t\n     :contexts        (toplevel)\n     :framework       exttypescript)\n\n    (:name            \"ExtTYPESCRIPT (style 2)\"\n     :class-decl      ,typescript--exttypescript-class-decl-re-2\n     :contexts        (toplevel)\n     :framework       exttypescript)\n\n    (:name            \"Merrill Press\"\n     :class-decl      ,typescript--mp-class-decl-re\n     :contexts        (toplevel)\n     :framework       merrillpress))\n\n  \"List of typescript class definition styles.\n\nA class definition style is a plist with the following keys:\n\n:name is a human-readable name of the class type\n\n:class-decl is a regular expression giving the start of the\nclass.  Its first group must match the name of its class.  If there\nis a parent class, the second group should match, and it should be\nthe name of the class.\n\nIf :prototype is present and non-nil, the parser will merge\ndeclarations for this constructs with others at the same lexical\nlevel that have the same name.  Otherwise, multiple definitions\nwill create multiple top-level entries.  Don't use :prototype\nunnecessarily: it has an associated cost in performance.\n\nIf :strip-prototype is present and non-nil, then if the class\nname as matched contains\")\n\n(defconst typescript--available-frameworks\n  (cl-loop with available-frameworks\n        for style in typescript--class-styles\n        for framework = (plist-get style :framework)\n        unless (memq framework available-frameworks)\n        collect framework into available-frameworks\n        finally return available-frameworks)\n  \"List of available typescript frameworks symbols.\")\n\n(defconst typescript--function-heading-1-re\n  (concat\n   typescript--module-declaration-re\n   \"\\\\s-*function\\\\s-+\\\\(\" typescript--name-re \"\\\\)\")\n  \"Regexp matching the start of a typescript function header.\nMatch group 1 is the name of the function.\")\n\n(defconst typescript--function-heading-2-re\n  (concat\n   \"^\\\\s-*\\\\(\" typescript--name-re \"\\\\)\\\\s-*:\\\\s-*function\\\\_>\")\n  \"Regexp matching the start of a function entry in an associative array.\nMatch group 1 is the name of the function.\")\n\n(defconst typescript--function-heading-3-re\n  (concat\n   \"^\\\\s-*\\\\(?:var\\\\s-+\\\\)?\\\\(\" typescript--dotted-name-re \"\\\\)\"\n   \"\\\\s-*=\\\\s-*function\\\\_>\")\n  \"Regexp matching a line in the typescript form \\\"var MUMBLE = function\\\".\nMatch group 1 is MUMBLE.\")\n\n(defun typescript--regexp-opt-symbol (list)\n  \"Like `regexp-opt', but surround the result with `\\\\\\\\_<' and `\\\\\\\\_>'.\"\n  (concat \"\\\\_<\" (regexp-opt list t) \"\\\\_>\"))\n\n(defconst typescript--keyword-re\n  (typescript--regexp-opt-symbol\n   '(\"abstract\" \"any\" \"as\" \"async\" \"await\" \"boolean\" \"bigint\" \"break\" \"case\" \"catch\" \"class\" \"const\"\n     \"constructor\" \"continue\" \"debugger\" \"declare\" \"default\" \"delete\" \"do\" \"else\"\n     \"enum\" \"export\" \"extends\" \"extern\" \"false\" \"finally\" \"for\"\n     \"function\" \"from\" \"get\" \"goto\" \"if\" \"implements\" \"import\" \"in\" \"infer\" \"instanceof\"\n     \"interface\" \"keyof\" \"let\" \"module\" \"namespace\" \"never\" \"new\" \"null\" \"number\" \"object\" \"of\"\n     \"override\" \"private\" \"protected\" \"public\" \"readonly\" \"return\" \"satisfies\" \"set\" \"static\"\n     \"string\" \"super\" \"switch\" \"this\" \"throw\" \"true\"\n     \"try\" \"type\" \"typeof\" \"unknown\" \"var\" \"void\"\n     \"while\")) ; yield is handled separately\n  \"Regexp matching any typescript keyword.\")\n\n(defconst typescript--basic-type-re\n  (typescript--regexp-opt-symbol\n   '(\"any\" \"bool\" \"boolean\" \"bigint\" \"never\" \"number\" \"string\" \"unknown\" \"void\"))\n  \"Regular expression matching any predefined type in typescript.\")\n\n(defconst typescript--access-modifier-re\n  (typescript--regexp-opt-symbol\n   '(\"private\" \"protected\" \"public\" \"readonly\" \"static\" \"extends\" \"implements\"))\n  \"Regular expression matching access modifiers.\")\n\n(defconst typescript--decorator-re\n  (concat \"\\\\(@\" typescript--name-re \"\\\\)\"))\n\n(defconst typescript--constant-re\n  (typescript--regexp-opt-symbol '(\"false\" \"null\" \"undefined\"\n                                 \"Infinity\" \"NaN\"\n                                 \"true\" \"arguments\" \"this\"))\n  \"Regular expression matching any future reserved words in typescript.\")\n\n(defconst typescript--builtin-re\n  (typescript--regexp-opt-symbol\n   '(\"console\"))\n  \"Regular expression matching builtins.\")\n\n(defconst typescript--function-call-re \"\\\\(\\\\(?:\\\\w\\\\|\\\\s_\\\\)+\\\\)\\\\(<.+>\\\\)?\\s*(\"\n  \"Regular expression matching function calls.\")\n\n(defconst typescript--font-lock-keywords-1\n  (list\n   \"\\\\_<import\\\\_>\"\n   (list typescript--function-heading-1-re 1 font-lock-function-name-face)\n   (list typescript--function-heading-2-re 1 font-lock-function-name-face))\n  \"Level one font lock keywords for `typescript-mode'.\")\n\n(defconst typescript--font-lock-keywords-2\n  (append typescript--font-lock-keywords-1\n          `((,typescript--constant-re (0 'font-lock-constant-face))\n            (,typescript--basic-type-re (0 'font-lock-type-face))\n            (,typescript--keyword-re (1 'font-lock-keyword-face))\n            (\"\\\\_<for\\\\_>\"\n             (\"\\\\s-+\\\\(each\\\\)\\\\_>\" nil nil\n              (1 'font-lock-keyword-face)))\n            (\"\\\\_<yield\\\\(\\\\*\\\\|\\\\_>\\\\)\" (0 'font-lock-keyword-face))))\n  \"Level two font lock keywords for `typescript-mode'.\")\n\n;; typescript--pitem is the basic building block of the lexical\n;; database. When one refers to a real part of the buffer, the region\n;; of text to which it refers is split into a conceptual header and\n;; body. Consider the (very short) block described by a hypothetical\n;; typescript--pitem:\n;;\n;;   function foo(a,b,c) { return 42; }\n;;   ^                    ^            ^\n;;   |                    |            |\n;;   +- h-begin           +- h-end     +- b-end\n;;\n;; (Remember that these are buffer positions, and therefore point\n;; between characters, not at them. An arrow drawn to a character\n;; indicates the corresponding position is between that character and\n;; the one immediately preceding it.)\n;;\n;; The header is the region of text [h-begin, h-end], and is\n;; the text needed to unambiguously recognize the start of the\n;; construct. If the entire header is not present, the construct is\n;; not recognized at all. No other pitems may be nested inside the\n;; header.\n;;\n;; The body is the region [h-end, b-end]. It may contain nested\n;; typescript--pitem instances. The body of a pitem may be empty: in\n;; that case, b-end is equal to header-end.\n;;\n;; The three points obey the following relationship:\n;;\n;;   h-begin < h-end <= b-end\n;;\n;; We put a text property in the buffer on the character *before*\n;; h-end, and if we see it, on the character *before* b-end.\n;;\n;; The text property for h-end, typescript--pstate, is actually a list\n;; of all typescript--pitem instances open after the marked character.\n;;\n;; The text property for b-end, typescript--pend, is simply the\n;; typescript--pitem that ends after the marked character. (Because\n;; pitems always end when the paren-depth drops below a critical\n;; value, and because we can only drop one level per character, only\n;; one pitem may end at a given character.)\n;;\n;; In the structure below, we only store h-begin and (sometimes)\n;; b-end. We can trivially and quickly find h-end by going to h-begin\n;; and searching for an typescript--pstate text property. Since no other\n;; typescript--pitem instances can be nested inside the header of a\n;; pitem, the location after the character with this text property\n;; must be h-end.\n;;\n;; typescript--pitem instances are never modified (with the exception\n;; of the b-end field). Instead, modified copies are added at subseqnce parse points.\n;; (The exception for b-end and its caveats is described below.)\n;;\n\n(cl-defstruct (typescript--pitem (:type list))\n  ;; IMPORTANT: Do not alter the position of fields within the list.\n  ;; Various bits of code depend on their positions, particularly\n  ;; anything that manipulates the list of children.\n\n  ;; List of children inside this pitem's body\n  (children nil :read-only t)\n\n  ;; When we reach this paren depth after h-end, the pitem ends\n  (paren-depth nil :read-only t)\n\n  ;; Symbol or class-style plist if this is a class\n  (type nil :read-only t)\n\n  ;; See above\n  (h-begin nil :read-only t)\n\n  ;; List of strings giving the parts of the name of this pitem (e.g.,\n  ;; '(\"MyClass\" \"myMethod\"), or t if this pitem is anonymous\n  (name nil :read-only t)\n\n  ;; THIS FIELD IS MUTATED, and its value is shared by all copies of\n  ;; this pitem: when we copy-and-modify pitem instances, we share\n  ;; their tail structures, so all the copies actually have the same\n  ;; terminating cons cell. We modify that shared cons cell directly.\n  ;;\n  ;; The field value is either a number (buffer location) or nil if\n  ;; unknown.\n  ;;\n  ;; If the field's value is greater than `typescript--cache-end', the\n  ;; value is stale and must be treated as if it were nil. Conversely,\n  ;; if this field is nil, it is guaranteed that this pitem is open up\n  ;; to at least `typescript--cache-end'. (This property is handy when\n  ;; computing whether we're inside a given pitem.)\n  ;;\n  (b-end nil))\n\n;; The pitem we start parsing with.\n(defconst typescript--initial-pitem\n  (make-typescript--pitem\n   :paren-depth most-negative-fixnum\n   :type 'toplevel))\n\n;; When we say \"jsdoc\" here, we mean \"jsdoc 3\". There exist multiple dialects of\n;; \"jsdoc documentation\".\n\n;; Note that all typedoc/jsdoc regexp by themselves would match occurrences that appear outside\n;; documentation comments. The logic that uses these regexps must guard against it.\n(defconst typescript-typedoc-link-tag-regexp\n  \"\\\\[\\\\[.*?\\\\]\\\\]\"\n  \"Matches a typedoc link.\")\n\n(defconst typescript-typedoc-literal-markup-regexp\n  \"\\\\(`+\\\\).*?\\\\1\"\n  \"Matches a typedoc keyword markup.\")\n\n(defconst typescript-jsdoc-before-tag-regexp\n  \"\\\\(?:^\\\\s-*\\\\*+\\\\|/\\\\*\\\\*\\\\)\\\\s-*\"\n  \"Matches everything we allow before the @ of a jsdoc tag.\")\n\n;; This was taken from js2-mode.\n(defconst typescript-jsdoc-param-tag-regexp\n  (concat typescript-jsdoc-before-tag-regexp\n          \"\\\\(@\"\n          (regexp-opt\n           '(\"arg\"\n             \"argument\"\n             \"param\"\n             \"prop\"\n             \"property\"\n             \"typedef\"))\n          \"\\\\)\"\n          \"\\\\s-*\\\\({[^}]+}\\\\)?\"         ; optional type\n          \"\\\\s-*\\\\[?\\\\([[:alnum:]_$\\.]+\\\\)?\\\\]?\"  ; name\n          \"\\\\_>\")\n  \"Matches jsdoc tags with optional type and optional param name.\")\n\n;; This was taken from js2-mode.\n;; and extended with tags in http://usejsdoc.org/\n(defconst typescript-jsdoc-typed-tag-regexp\n  (concat typescript-jsdoc-before-tag-regexp\n          \"\\\\(@\"\n          (regexp-opt\n           '(\"enum\"\n             \"extends\"\n             \"field\"\n             \"id\"\n             \"implements\"\n             \"lends\"\n             \"mods\"\n             \"requires\"\n             \"return\"\n             \"returns\"\n             \"throw\"\n             \"throws\"\n             \"type\"\n             \"yield\"\n             \"yields\"))\n          \"\\\\)\\\\s-*\\\\({[^}]+}\\\\)?\")\n  \"Matches jsdoc tags with optional type.\")\n\n;; This was taken from js2-mode.\n;; and extended with tags in http://usejsdoc.org/\n(defconst typescript-jsdoc-arg-tag-regexp\n  (concat typescript-jsdoc-before-tag-regexp\n          \"\\\\(@\"\n          (regexp-opt\n           '(\"access\"\n             \"alias\"\n             \"augments\"\n             \"base\"\n             \"borrows\"\n             \"bug\"\n             \"callback\"\n             \"config\"\n             \"default\"\n             \"define\"\n             \"emits\"\n             \"exception\"\n             \"extends\"\n             \"external\"\n             \"fires\"\n             \"func\"\n             \"function\"\n             \"host\"\n             \"kind\"\n             \"listens\"\n             \"member\"\n             \"memberof\"\n             \"method\"\n             \"mixes\"\n             \"module\"\n             \"name\"\n             \"namespace\"\n             \"requires\"\n             \"since\"\n             \"suppress\"\n             \"this\"\n             \"throws\"\n             \"var\"\n             \"variation\"\n             \"version\"))\n          \"\\\\)\\\\s-+\\\\([^ \\t]+\\\\)\")\n  \"Matches jsdoc tags with a single argument.\")\n\n;; This was taken from js2-mode\n;; and extended with tags in http://usejsdoc.org/\n(defconst typescript-jsdoc-empty-tag-regexp\n  (concat typescript-jsdoc-before-tag-regexp\n          \"\\\\(@\"\n          (regexp-opt\n           '(\"abstract\"\n             \"addon\"\n             \"async\"\n             \"author\"\n             \"class\"\n             \"classdesc\"\n             \"const\"\n             \"constant\"\n             \"constructor\"\n             \"constructs\"\n             \"copyright\"\n             \"default\"\n             \"defaultvalue\"\n             \"deprecated\"\n             \"desc\"\n             \"description\"\n             \"event\"\n             \"example\"\n             \"exec\"\n             \"export\"\n             \"exports\"\n             \"file\"\n             \"fileoverview\"\n             \"final\"\n             \"func\"\n             \"function\"\n             \"generator\"\n             \"global\"\n             \"hidden\"\n             \"hideconstructor\"\n             \"ignore\"\n             \"implicitcast\"\n             \"inheritdoc\"\n             \"inner\"\n             \"instance\"\n             \"interface\"\n             \"license\"\n             \"method\"\n             \"mixin\"\n             \"noalias\"\n             \"noshadow\"\n             \"notypecheck\"\n             \"override\"\n             \"overview\"\n             \"owner\"\n             \"package\"\n             \"preserve\"\n             \"preservetry\"\n             \"private\"\n             \"protected\"\n             \"public\"\n             \"readonly\"\n             \"static\"\n             \"summary\"\n             \"supported\"\n             \"todo\"\n             \"tutorial\"\n             \"virtual\"))\n          \"\\\\)\\\\s-*\")\n  \"Matches empty jsdoc tags.\")\n\n;; Note that this regexp by itself would match tslint flags that appear inside\n;; strings. The logic using this regexp must guard against it.\n(defconst typescript-tslint-flag-regexp\n  \"\\\\(?://\\\\|/\\\\*\\\\)\\\\s-*\\\\(tslint:.*?\\\\)\\\\(?:\\\\*/\\\\|$\\\\)\"\n  \"Matches tslint flags.\")\n\n;;; Faces\n\n(defface typescript-jsdoc-tag\n  '((t :foreground \"SlateGray\"))\n  \"Face used to highlight @whatever tags in jsdoc comments.\"\n  :group 'typescript)\n\n(defface typescript-jsdoc-type\n  '((t :foreground \"SteelBlue\"))\n  \"Face used to highlight {FooBar} types in jsdoc comments.\"\n  :group 'typescript)\n\n(defface typescript-jsdoc-value\n  '((t :foreground \"gold4\"))\n  \"Face used to highlight tag values in jsdoc comments.\"\n  :group 'typescript)\n\n(defface typescript-access-modifier-face\n  '((t (:inherit font-lock-keyword-face)))\n  \"Face used to highlight access modifiers.\"\n  :group 'typescript)\n\n(defface typescript-this-face\n  '((t (:inherit font-lock-keyword-face)))\n  \"Face used to highlight 'this' keyword.\"\n  :group 'typescript)\n\n(defface typescript-primitive-face\n  '((t (:inherit font-lock-keyword-face)))\n  \"Face used to highlight builtin types.\"\n  :group 'typescript)\n\n;;; User Customization\n\n(defgroup typescript nil\n  \"Customization variables for typescript mode.\"\n  :tag \"typescript\"\n  :group 'languages)\n\n(defcustom typescript-indent-level 4\n  \"Number of spaces for each indentation step in `typescript-mode'.\"\n  :type 'integer\n  :safe 'integerp\n  :group 'typescript)\n;;;###autoload(put 'typescript-indent-level 'safe-local-variable #'integerp)\n\n(defcustom typescript-expr-indent-offset 0\n  \"Number of additional spaces used for indentation of continued expressions.\nThe value must be no less than minus `typescript-indent-level'.\"\n  :type 'integer\n  :safe 'integerp\n  :group 'typescript)\n\n(defcustom typescript-indent-switch-clauses t\n  \"Enable indenting of switch case and default clauses to\nreplicate tsserver behaviour. Indent level is taken to be\n`typescript-indent-level'.\"\n  :type 'boolean\n  :group 'typescript)\n\n(defcustom typescript-indent-list-items t\n  \"Enable indenting of list items, useful for certain code styles.\"\n  :type 'boolean\n  :group 'typescript)\n\n(defcustom typescript-auto-indent-flag t\n  \"Whether to automatically indent when typing punctuation characters.\nIf non-nil, the characters {}();,: also indent the current line\nin typescript mode.\"\n  :type 'boolean\n  :group 'typescript)\n\n(defcustom typescript-flat-functions nil\n  \"Treat nested functions as top-level functions in `typescript-mode'.\nThis applies to function movement, marking, and so on.\"\n  :type 'boolean\n  :group 'typescript)\n\n(defcustom typescript-comment-lineup-func #'c-lineup-C-comments\n  \"Lineup function for `cc-mode-style', for C comments in `typescript-mode'.\"\n  :type 'function\n  :group 'typescript)\n\n(defcustom typescript-enabled-frameworks typescript--available-frameworks\n  \"Frameworks recognized by `typescript-mode'.\nTo improve performance, you may turn off some frameworks you\nseldom use, either globally or on a per-buffer basis.\"\n  :type (cons 'set (mapcar (lambda (x)\n                             (list 'const x))\n                           typescript--available-frameworks))\n  :group 'typescript)\n\n(defcustom typescript-mode-hook nil\n  \"*Hook called by `typescript-mode'.\"\n  :type 'hook\n  :group 'typescript)\n\n(defcustom typescript-autoconvert-to-template-flag nil\n  \"Non-nil means automatically convert plain strings to templates.\n\nWhen the flag is non-nil the `typescript-autoconvert-to-template'\nis called whenever a plain string delimiter is typed in the buffer.\"\n  :type 'boolean\n  :group 'typescript)\n\n;;; Public utilities\n\n(defun typescript-convert-to-template ()\n  \"Convert the string at point to a template string.\"\n  (interactive)\n  (save-restriction\n    (widen)\n    (save-excursion\n      (let* ((syntax (syntax-ppss))\n             (str-terminator (nth 3 syntax))\n             (string-start (or (and str-terminator (nth 8 syntax))\n                               ;; We have to consider the case that we're on the start delimiter of a string.\n                               ;; We tentatively take (point) as string-start. If it turns out we're\n                               ;; wrong, then typescript--move-to-end-of-plain-string will fail anyway,\n                               ;; and we won't use the bogus value.\n                               (progn\n                                 (forward-char)\n                                 (point)))))\n        (when (typescript--move-to-end-of-plain-string)\n          (let ((end-start (or (nth 8 (syntax-ppss)) -1)))\n            (undo-boundary)\n            (when (=  end-start string-start)\n              (delete-char 1)\n              (insert \"`\")))\n          (goto-char string-start)\n          (delete-char 1)\n          (insert \"`\"))))))\n\n(defun typescript-autoconvert-to-template ()\n  \"Automatically convert a plain string to a teplate string, if needed.\n\nThis function is meant to be automatically invoked when the user\nenters plain string delimiters.  It checks whether the character\nbefore point is the end of a string.  If it is, then it checks\nwhether the string contains ${...}.  If it does, then it converts\nthe string from a plain string to a template.\"\n  (interactive)\n  (save-restriction\n    (widen)\n    (save-excursion\n      (backward-char)\n      (when (and (memq (char-after) '(?' ?\\\"))\n                 (not (eq (char-before) ?\\\\)))\n        (let* ((string-start (nth 8 (syntax-ppss))))\n          (when (and string-start\n                     (save-excursion\n                       (re-search-backward \"\\\\${.*?}\" string-start t)))\n            (typescript-convert-to-template)))))))\n\n;;; KeyMap\n\n(defvar typescript-mode-map\n  (let ((keymap (make-sparse-keymap)))\n    (define-key keymap (kbd \"C-c '\") #'typescript-convert-to-template)\n    keymap)\n  \"Keymap for `typescript-mode'.\")\n\n(defun typescript--post-self-insert-function ()\n  (when (and (derived-mode-p 'typescript-mode)\n             typescript-autoconvert-to-template-flag\n             (or (eq last-command-event ?\\')\n                 (eq last-command-event ?\\\")))\n    (typescript-autoconvert-to-template)))\n\n;;; Syntax table and parsing\n\n(defvar typescript-mode-syntax-table\n  (let ((table (make-syntax-table)))\n    (c-populate-syntax-table table)\n    (modify-syntax-entry ?$ \"_\" table)\n    (modify-syntax-entry ?` \"\\\"\" table)\n    table)\n  \"Syntax table for `typescript-mode'.\")\n\n(defvar typescript--quick-match-re nil\n  \"Autogenerated regexp used by `typescript-mode' to match buffer constructs.\")\n\n(defvar typescript--quick-match-re-func nil\n  \"Autogenerated regexp used by `typescript-mode' to match constructs and functions.\")\n\n(make-variable-buffer-local 'typescript--quick-match-re)\n(make-variable-buffer-local 'typescript--quick-match-re-func)\n\n(defvar typescript--cache-end 1\n  \"Last valid buffer position for the `typescript-mode' function cache.\")\n(make-variable-buffer-local 'typescript--cache-end)\n\n(defvar typescript--last-parse-pos nil\n  \"Latest parse position reached by `typescript--ensure-cache'.\")\n(make-variable-buffer-local 'typescript--last-parse-pos)\n\n(defvar typescript--state-at-last-parse-pos nil\n  \"Parse state at `typescript--last-parse-pos'.\")\n(make-variable-buffer-local 'typescript--state-at-last-parse-pos)\n\n(defun typescript--flatten-list (list)\n  (cl-loop for item in list\n        nconc (cond ((consp item)\n                     (typescript--flatten-list item))\n                    (item (list item)))))\n\n(defun typescript--maybe-join (prefix separator suffix &rest list)\n  \"Helper function for `typescript--update-quick-match-re'.\nIf LIST contains any element that is not nil, return its non-nil\nelements, separated by SEPARATOR, prefixed by PREFIX, and ended\nwith SUFFIX as with `concat'.  Otherwise, if LIST is empty, return\nnil.  If any element in LIST is itself a list, flatten that\nelement.\"\n  (setq list (typescript--flatten-list list))\n  (when list\n    (concat prefix (mapconcat #'identity list separator) suffix)))\n\n(defun typescript--update-quick-match-re ()\n  \"Internal function used by `typescript-mode' for caching buffer constructs.\nThis updates `typescript--quick-match-re', based on the current set of\nenabled frameworks.\"\n  (setq typescript--quick-match-re\n        (typescript--maybe-join\n         \"^[ \\t]*\\\\(?:\" \"\\\\|\" \"\\\\)\"\n\n         ;; #define mumble\n         \"#define[ \\t]+[a-zA-Z_]\"\n\n         (when (memq 'exttypescript typescript-enabled-frameworks)\n           \"Ext\\\\.extend\")\n\n         (when (memq 'prototype typescript-enabled-frameworks)\n           \"Object\\\\.extend\")\n\n          ;; var mumble = THING (\n         (typescript--maybe-join\n          \"\\\\(?:var[ \\t]+\\\\)?[a-zA-Z_$0-9.]+[ \\t]*=[ \\t]*\\\\(?:\"\n          \"\\\\|\"\n          \"\\\\)[ \\t]*\\(\"\n\n          (when (memq 'prototype typescript-enabled-frameworks)\n                    \"Class\\\\.create\")\n\n          (when (memq 'exttypescript typescript-enabled-frameworks)\n            \"Ext\\\\.extend\")\n\n          (when (memq 'merrillpress typescript-enabled-frameworks)\n            \"[a-zA-Z_$0-9]+\\\\.extend\\\\(?:Final\\\\)?\"))\n\n         (when (memq 'dojo typescript-enabled-frameworks)\n           \"dojo\\\\.declare[ \\t]*\\(\")\n\n         (when (memq 'mochikit typescript-enabled-frameworks)\n           \"MochiKit\\\\.Base\\\\.update[ \\t]*\\(\")\n\n         ;; mumble.prototypeTHING\n         (typescript--maybe-join\n          \"[a-zA-Z_$0-9.]+\\\\.prototype\\\\(?:\" \"\\\\|\" \"\\\\)\"\n\n          (when (memq 'typescript typescript-enabled-frameworks)\n            '( ;; foo.prototype.bar = function(\n              \"\\\\.[a-zA-Z_$0-9]+[ \\t]*=[ \\t]*function[ \\t]*\\(\"\n\n              ;; mumble.prototype = {\n              \"[ \\t]*=[ \\t]*{\")))))\n\n  (setq typescript--quick-match-re-func\n        (concat \"function\\\\|\" typescript--quick-match-re)))\n\n(defun typescript--forward-text-property (propname)\n  \"Move over the next value of PROPNAME in the buffer.\nIf found, return that value and leave point after the character\nhaving that value; otherwise, return nil and leave point at EOB.\"\n  (let ((next-value (get-text-property (point) propname)))\n    (if next-value\n        (forward-char)\n\n      (goto-char (next-single-property-change\n                  (point) propname nil (point-max)))\n      (unless (eobp)\n        (setq next-value (get-text-property (point) propname))\n        (forward-char)))\n\n    next-value))\n\n(defun typescript--backward-text-property (propname)\n  \"Move over the previous value of PROPNAME in the buffer.\nIf found, return that value and leave point just before the\ncharacter that has that value, otherwise return nil and leave\npoint at BOB.\"\n    (unless (bobp)\n      (let ((prev-value (get-text-property (1- (point)) propname)))\n        (if prev-value\n            (backward-char)\n\n          (goto-char (previous-single-property-change\n                      (point) propname nil (point-min)))\n\n          (unless (bobp)\n            (backward-char)\n            (setq prev-value (get-text-property (point) propname))))\n\n        prev-value)))\n\n(defsubst typescript--forward-pstate ()\n  (typescript--forward-text-property 'typescript--pstate))\n\n(defsubst typescript--backward-pstate ()\n  (typescript--backward-text-property 'typescript--pstate))\n\n(defun typescript--pitem-goto-h-end (pitem)\n  (goto-char (typescript--pitem-h-begin pitem))\n  (typescript--forward-pstate))\n\n(defun typescript--re-search-forward-inner (regexp &optional bound count)\n  \"Helper function for `typescript--re-search-forward'.\"\n  (let ((parse)\n        str-terminator)\n    (while (> count 0)\n      (re-search-forward regexp bound)\n      (setq parse (syntax-ppss))\n      (cond ((setq str-terminator (nth 3 parse))\n             (when (eq str-terminator t)\n               (setq str-terminator ?/))\n             (re-search-forward\n              (concat \"\\\\([^\\\\]\\\\|^\\\\)\" (string str-terminator))\n              (save-excursion (end-of-line) (point)) t))\n            ((nth 7 parse)\n             (forward-line))\n            ((or (nth 4 parse)\n                 (and (eq (char-before) ?\\/) (eq (char-after) ?\\*)))\n             (re-search-forward \"\\\\*/\"))\n            (t\n             (setq count (1- count))))))\n  (point))\n\n\n(defun typescript--re-search-forward (regexp &optional bound noerror count)\n  \"Search forward, ignoring strings and comments.\nThis function invokes `re-search-forward', but treats the buffer\nas if strings and comments have been removed.\"\n  (let ((saved-point (point))\n        (search-fun\n         (cond ((null count)\n                (lambda () (typescript--re-search-forward-inner regexp bound 1)))\n               ((< count 0)\n                (lambda () (typescript--re-search-backward-inner regexp bound (- count))))\n               ((> count 0)\n                (lambda () (typescript--re-search-forward-inner regexp bound count)))\n               (t #'ignore))))\n    (condition-case err\n        (funcall search-fun)\n      (search-failed\n       (goto-char saved-point)\n       (unless noerror\n         (error (error-message-string err)))))))\n\n\n(defun typescript--re-search-backward-inner (regexp &optional bound count)\n  \"Auxiliary function for `typescript--re-search-backward'.\"\n  (let ((parse))\n    (while (> count 0)\n      (re-search-backward regexp bound)\n      (when (and (> (point) (point-min))\n                 (save-excursion (backward-char) (looking-at \"/[/*]\")))\n        (forward-char))\n      (setq parse (syntax-ppss))\n      (cond\n       ;; If we are in a comment or a string, jump back to the start\n       ;; of the comment or string.\n       ((nth 8 parse)\n        (goto-char (nth 8 parse)))\n       ((and (eq (char-before) ?/) (eq (char-after) ?*))\n        (re-search-backward \"/\\\\*\"))\n       (t\n        (setq count (1- count))))))\n  (point))\n\n\n(defun typescript--re-search-backward (regexp &optional bound noerror count)\n  \"Search backward, ignoring strings, and comments.\n\nThis function invokes `re-search-backward' but treats the buffer\nas if strings and comments have been removed.\n\nIMPORTANT NOTE: searching for \\\"\\\\n\\\" with this function to find\nline breaks will generally not work, because the final newline of\na one-line comment is considered to be part of the comment and\nwill be skipped.  Take the following code:\n\n  let a = 1;\n  let b = 2; // Foo\n  let c = 3;\n\nIf the point is in the last line, searching back for \\\"\\\\n\\\" will\nskip over the line with \\\"let b\\\". The newline found will be the\none at the end of the line with \\\"let a\\\".\"\n  (let ((saved-point (point))\n        (search-fun\n         (cond ((null count)\n                (lambda () (typescript--re-search-backward-inner regexp bound 1)))\n               ((< count 0)\n                (lambda () (typescript--re-search-forward-inner regexp bound (- count))))\n               ((> count 0)\n                (lambda () (typescript--re-search-backward-inner regexp bound count)))\n               (t #'ignore))))\n    (condition-case err\n        (funcall search-fun)\n      (search-failed\n       (goto-char saved-point)\n       (unless noerror\n         (error (error-message-string err)))))))\n\n(defun typescript--forward-expression ()\n  \"Move forward over a whole typescript expression.\nThis function doesn't move over expressions continued across\nlines.\"\n  (cl-loop\n   do (progn\n        (forward-comment most-positive-fixnum)\n        (cl-loop until (or (eolp)\n                        (progn\n                          (forward-comment most-positive-fixnum)\n                          (memq (char-after) '(?\\, ?\\; ?\\] ?\\) ?\\}))))\n                 do (forward-sexp)))\n   while (and (eq (char-after) ?\\n)\n              (save-excursion\n                (forward-char)\n                (typescript--continued-expression-p)))))\n\n(defun typescript--forward-function-decl ()\n  \"Move forward over a typescript function declaration.\nThis puts point at the 'function' keyword.\n\nIf this is a syntactically-correct non-expression function,\nreturn the name of the function, or t if the name could not be\ndetermined.  Otherwise, return nil.\"\n  (cl-assert (looking-at \"\\\\_<function\\\\_>\"))\n  (let ((name t))\n    (forward-word)\n    (forward-comment most-positive-fixnum)\n    (when (looking-at typescript--name-re)\n      (setq name (match-string-no-properties 0))\n      (goto-char (match-end 0)))\n    (forward-comment most-positive-fixnum)\n    (and (eq (char-after) ?\\( )\n         (ignore-errors (forward-list) t)\n         (progn (forward-comment most-positive-fixnum)\n                (and (eq (char-after) ?{)\n                     name)))))\n\n(defun typescript--function-prologue-beginning (&optional pos)\n  \"Return the start of the typescript function prologue containing POS.\nA function prologue is everything from start of the definition up\nto and including the opening brace.  POS defaults to point.\nIf POS is not in a function prologue, return nil.\"\n  (let (prologue-begin)\n    (save-excursion\n      (if pos\n          (goto-char pos)\n        (setq pos (point)))\n\n      (when (save-excursion\n              (forward-line 0)\n              (or (looking-at typescript--function-heading-2-re)\n                  (looking-at typescript--function-heading-3-re)))\n\n        (setq prologue-begin (match-beginning 1))\n        (when (<= prologue-begin pos)\n          (goto-char (match-end 0))))\n\n      (skip-syntax-backward \"w_\")\n      (and (or (looking-at \"\\\\_<function\\\\_>\")\n               (typescript--re-search-backward \"\\\\_<function\\\\_>\" nil t))\n\n           (save-match-data (goto-char (match-beginning 0))\n                            (typescript--forward-function-decl))\n\n           (<= pos (point))\n           (or prologue-begin (match-beginning 0))))))\n\n(defun typescript--beginning-of-defun-raw ()\n  \"Helper function for `typescript-beginning-of-defun'.\nGo to previous defun-beginning and return the parse state for it,\nor nil if we went all the way back to bob and don't find\nanything.\"\n  (typescript--ensure-cache)\n  (let (pstate)\n    (while (and (setq pstate (typescript--backward-pstate))\n                (not (eq 'function (typescript--pitem-type (car pstate))))))\n    (and (not (bobp)) pstate)))\n\n(defun typescript--pstate-is-toplevel-defun (pstate)\n  \"Helper function for `typescript--beginning-of-defun-nested'.\nIf PSTATE represents a non-empty top-level defun, return the\ntop-most pitem.  Otherwise, return nil.\"\n  (cl-loop for pitem in pstate\n        with func-depth = 0\n        with func-pitem\n        if (eq 'function (typescript--pitem-type pitem))\n        do (cl-incf func-depth)\n        and do (setq func-pitem pitem)\n        finally return (if (eq func-depth 1) func-pitem)))\n\n(defun typescript--beginning-of-defun-nested ()\n  \"Helper function for `typescript--beginning-of-defun'.\nReturn the pitem of the function we went to the beginning of.\"\n  (or\n   ;; Look for the smallest function that encloses point...\n   (cl-loop for pitem in (typescript--parse-state-at-point)\n         if (and (eq 'function (typescript--pitem-type pitem))\n                 (typescript--inside-pitem-p pitem))\n         do (goto-char (typescript--pitem-h-begin pitem))\n         and return pitem)\n\n   ;; ...and if that isn't found, look for the previous top-level\n   ;; defun\n   (cl-loop for pstate = (typescript--backward-pstate)\n         while pstate\n         if (typescript--pstate-is-toplevel-defun pstate)\n         do (goto-char (typescript--pitem-h-begin it))\n         and return it)))\n\n(defun typescript--beginning-of-defun-flat ()\n  \"Helper function for `typescript-beginning-of-defun'.\"\n  (let ((pstate (typescript--beginning-of-defun-raw)))\n    (when pstate\n      (goto-char (typescript--pitem-h-begin (car pstate))))))\n\n(defun typescript-beginning-of-defun (&optional arg)\n  \"Value of `beginning-of-defun-function' for `typescript-mode'.\"\n  (setq arg (or arg 1))\n  (while (and (not (eobp)) (< arg 0))\n    (cl-incf arg)\n    (when (and (not typescript-flat-functions)\n               (or (eq (typescript-syntactic-context) 'function)\n                   (typescript--function-prologue-beginning)))\n      (typescript-end-of-defun))\n\n    (if (typescript--re-search-forward\n         \"\\\\_<function\\\\_>\" nil t)\n        (goto-char (typescript--function-prologue-beginning))\n      (goto-char (point-max))))\n\n  (while (> arg 0)\n    (cl-decf arg)\n    ;; If we're just past the end of a function, the user probably wants\n    ;; to go to the beginning of *that* function\n    (when (eq (char-before) ?})\n      (backward-char))\n\n    (let ((prologue-begin (typescript--function-prologue-beginning)))\n      (cond ((and prologue-begin (< prologue-begin (point)))\n             (goto-char prologue-begin))\n\n            (typescript-flat-functions\n             (typescript--beginning-of-defun-flat))\n            (t\n             (typescript--beginning-of-defun-nested))))))\n\n(defun typescript--flush-caches (&optional beg ignored)\n  \"Flush the `typescript-mode' syntax cache after position BEG.\nBEG defaults to `point-min', meaning to flush the entire cache.\"\n  (interactive)\n  (setq beg (or beg (save-restriction (widen) (point-min))))\n  (setq typescript--cache-end (min typescript--cache-end beg)))\n\n(defmacro typescript--debug (&rest arguments)\n  ;; `(message ,@arguments)\n  )\n\n(defun typescript--ensure-cache--pop-if-ended (open-items paren-depth)\n  (let ((top-item (car open-items)))\n    (when (<= paren-depth (typescript--pitem-paren-depth top-item))\n      (cl-assert (not (get-text-property (1- (point)) 'typescript-pend)))\n      (put-text-property (1- (point)) (point) 'typescript--pend top-item)\n      (setf (typescript--pitem-b-end top-item) (point))\n      (setq open-items\n            ;; open-items must contain at least two items for this to\n            ;; work, but because we push a dummy item to start with,\n            ;; that assumption holds.\n            (cons (typescript--pitem-add-child (cl-second open-items) top-item)\n                  (cddr open-items)))))\n  open-items)\n\n(defmacro typescript--ensure-cache--update-parse ()\n  \"Helper function for `typescript--ensure-cache'.\nUpdate parsing information up to point, referring to parse,\nprev-parse-point, goal-point, and open-items bound lexically in\nthe body of `typescript--ensure-cache'.\"\n  `(progn\n     (setq goal-point (point))\n     (goto-char prev-parse-point)\n     (while (progn\n              (setq open-items (typescript--ensure-cache--pop-if-ended\n                                open-items (car parse)))\n              ;; Make sure parse-partial-sexp doesn't stop because we *entered*\n              ;; the given depth -- i.e., make sure we're deeper than the target\n              ;; depth.\n              (cl-assert (> (nth 0 parse)\n                         (typescript--pitem-paren-depth (car open-items))))\n              (setq parse (parse-partial-sexp\n                           prev-parse-point goal-point\n                           (typescript--pitem-paren-depth (car open-items))\n                           nil parse))\n\n;;              (let ((overlay (make-overlay prev-parse-point (point))))\n;;                (overlay-put overlay 'face '(:background \"red\"))\n;;                (unwind-protect\n;;                     (progn\n;;                       (typescript--debug \"parsed: %S\" parse)\n;;                       (sit-for 1))\n;;                  (delete-overlay overlay)))\n\n              (setq prev-parse-point (point))\n              (< (point) goal-point)))\n\n     (setq open-items (typescript--ensure-cache--pop-if-ended\n                       open-items (car parse)))))\n\n(defun typescript--show-cache-at-point ()\n  (interactive)\n  (require 'pp)\n  (let ((prop (get-text-property (point) 'typescript--pstate)))\n    (with-output-to-temp-buffer \"*Help*\"\n      (pp prop))))\n\n(defun typescript--split-name (string)\n  \"Split a typescript name into its dot-separated parts.\nThis also removes any prototype parts from the split name\n\\(unless the name is just \\\"prototype\\\" to start with).\"\n  (let ((name (save-match-data\n                (split-string string \"\\\\.\" t))))\n    (unless (and (= (length name) 1)\n                 (equal (car name) \"prototype\"))\n\n      (setq name (remove \"prototype\" name)))))\n\n(defvar typescript--guess-function-name-start nil)\n\n(defun typescript--guess-function-name (position)\n  \"Guess the name of the typescript function at POSITION.\nPOSITION should be just after the end of the word \\\"function\\\".\nReturn the name of the function, or nil if the name could not be\nguessed.\n\nThis function clobbers match data.  If we find the preamble\nbegins earlier than expected while guessing the function name,\nset `typescript--guess-function-name-start' to that position; otherwise,\nset that variable to nil.\"\n  (setq typescript--guess-function-name-start nil)\n  (save-excursion\n    (goto-char position)\n    (forward-line 0)\n    (cond\n     ((looking-at typescript--function-heading-3-re)\n      (and (eq (match-end 0) position)\n           (setq typescript--guess-function-name-start (match-beginning 1))\n           (match-string-no-properties 1)))\n\n     ((looking-at typescript--function-heading-2-re)\n      (and (eq (match-end 0) position)\n           (setq typescript--guess-function-name-start (match-beginning 1))\n           (match-string-no-properties 1))))))\n\n(defun typescript--clear-stale-cache ()\n  ;; Clear any endings that occur after point\n  (let (end-prop)\n    (save-excursion\n      (while (setq end-prop (typescript--forward-text-property\n                             'typescript--pend))\n        (setf (typescript--pitem-b-end end-prop) nil))))\n\n  ;; Remove any cache properties after this point\n  (remove-text-properties (point) (point-max)\n                          '(typescript--pstate t typescript--pend t)))\n\n(defun typescript--ensure-cache (&optional limit)\n  \"Ensures brace cache is valid up to the character before LIMIT.\nLIMIT defaults to point.\"\n  (setq limit (or limit (point)))\n  (when (< typescript--cache-end limit)\n\n    (c-save-buffer-state\n        (open-items\n         orig-match-start\n         orig-match-end\n         orig-depth\n         parse\n         prev-parse-point\n         name\n         case-fold-search\n         filtered-class-styles\n         new-item\n         goal-point\n         end-prop)\n\n      ;; Figure out which class styles we need to look for\n      (setq filtered-class-styles\n            (cl-loop for style in typescript--class-styles\n                  if (memq (plist-get style :framework)\n                           typescript-enabled-frameworks)\n                  collect style))\n\n      (save-excursion\n        (save-restriction\n          (widen)\n\n          ;; Find last known good position\n          (goto-char typescript--cache-end)\n          (unless (bobp)\n            (setq open-items (get-text-property\n                              (1- (point)) 'typescript--pstate))\n\n            (unless open-items\n              (goto-char (previous-single-property-change\n                          (point) 'typescript--pstate nil (point-min)))\n\n              (unless (bobp)\n                (setq open-items (get-text-property (1- (point))\n                                                    'typescript--pstate))\n                (cl-assert open-items))))\n\n          (unless open-items\n            ;; Make a placeholder for the top-level definition\n            (setq open-items (list typescript--initial-pitem)))\n\n          (setq parse (syntax-ppss))\n          (setq prev-parse-point (point))\n\n          (typescript--clear-stale-cache)\n\n          (narrow-to-region (point-min) limit)\n\n          (cl-loop while (re-search-forward typescript--quick-match-re-func nil t)\n                for orig-match-start = (goto-char (match-beginning 0))\n                for orig-match-end = (match-end 0)\n                do (typescript--ensure-cache--update-parse)\n                for orig-depth = (nth 0 parse)\n\n                ;; Each of these conditions should return non-nil if\n                ;; we should add a new item and leave point at the end\n                ;; of the new item's header (h-end in the\n                ;; typescript--pitem diagram). This point is the one\n                ;; after the last character we need to unambiguously\n                ;; detect this construct. If one of these evaluates to\n                ;; nil, the location of the point is ignored.\n                if (cond\n                    ;; In comment or string\n                    ((nth 8 parse) nil)\n\n                    ;; Regular function declaration\n                    ((and (looking-at \"\\\\_<function\\\\_>\")\n                          (setq name (typescript--forward-function-decl)))\n\n                     (when (eq name t)\n                       (setq name (typescript--guess-function-name orig-match-end))\n                       (if name\n                           (when typescript--guess-function-name-start\n                             (setq orig-match-start\n                                   typescript--guess-function-name-start))\n\n                         (setq name t)))\n\n                     (cl-assert (eq (char-after) ?{))\n                     (forward-char)\n                     (make-typescript--pitem\n                      :paren-depth orig-depth\n                      :h-begin orig-match-start\n                      :type 'function\n                      :name (if (eq name t)\n                                name\n                              (typescript--split-name name))))\n\n                    ;; \"Prototype function\" declaration\n                    ((looking-at typescript--plain-method-re)\n                     (goto-char (match-beginning 3))\n                     (when (save-match-data\n                             (typescript--forward-function-decl))\n                       (forward-char)\n                       (make-typescript--pitem\n                        :paren-depth orig-depth\n                        :h-begin orig-match-start\n                        :type 'function\n                        :name (nconc (typescript--split-name\n                                      (match-string-no-properties 1))\n                                     (list (match-string-no-properties 2))))))\n\n                    ;; Class definition\n                    ((cl-loop with syntactic-context =\n                           (typescript--syntactic-context-from-pstate open-items)\n                           for class-style in filtered-class-styles\n                           if (and (memq syntactic-context\n                                         (plist-get class-style :contexts))\n                                   (looking-at (plist-get class-style\n                                                          :class-decl)))\n                           do (goto-char (match-end 0))\n                           and return\n                           (make-typescript--pitem\n                            :paren-depth orig-depth\n                            :h-begin orig-match-start\n                            :type class-style\n                            :name (typescript--split-name\n                                   (match-string-no-properties 1))))))\n\n                do (typescript--ensure-cache--update-parse)\n                and do (push it open-items)\n                and do (put-text-property\n                        (1- (point)) (point) 'typescript--pstate open-items)\n                else do (goto-char orig-match-end))\n\n          (goto-char limit)\n          (typescript--ensure-cache--update-parse)\n          (setq typescript--cache-end limit)\n          (setq typescript--last-parse-pos limit)\n          (setq typescript--state-at-last-parse-pos open-items))))))\n\n(defun typescript--end-of-defun-flat ()\n  \"Helper function for `typescript-end-of-defun'.\"\n  (cl-loop while (typescript--re-search-forward \"}\" nil t)\n        do (typescript--ensure-cache)\n        if (get-text-property (1- (point)) 'typescript--pend)\n        if (eq 'function (typescript--pitem-type it))\n        return t\n        finally do (goto-char (point-max))))\n\n(defun typescript--end-of-defun-nested ()\n  \"Helper function for `typescript-end-of-defun'.\"\n  (let* (pitem\n         (this-end (save-excursion\n                     (and (setq pitem (typescript--beginning-of-defun-nested))\n                          (typescript--pitem-goto-h-end pitem)\n                          (progn (backward-char)\n                                 (forward-list)\n                                 (point)))))\n         found)\n\n    (if (and this-end (< (point) this-end))\n        ;; We're already inside a function; just go to its end.\n        (goto-char this-end)\n\n      ;; Otherwise, go to the end of the next function...\n      (while (and (typescript--re-search-forward \"\\\\_<function\\\\_>\" nil t)\n                  (not (setq found (progn\n                                     (goto-char (match-beginning 0))\n                                     (typescript--forward-function-decl))))))\n\n      (if found (forward-list)\n        ;; ... or eob.\n        (goto-char (point-max))))))\n\n(defun typescript-end-of-defun (&optional arg)\n  \"Value of `end-of-defun-function' for `typescript-mode'.\"\n  (setq arg (or arg 1))\n  (while (and (not (bobp)) (< arg 0))\n    (cl-incf arg)\n    (typescript-beginning-of-defun)\n    (typescript-beginning-of-defun)\n    (unless (bobp)\n      (typescript-end-of-defun)))\n\n  (while (> arg 0)\n    (cl-decf arg)\n    ;; look for function backward. if we're inside it, go to that\n    ;; function's end. otherwise, search for the next function's end and\n    ;; go there\n    (if typescript-flat-functions\n        (typescript--end-of-defun-flat)\n\n      ;; if we're doing nested functions, see whether we're in the\n      ;; prologue. If we are, go to the end of the function; otherwise,\n      ;; call typescript--end-of-defun-nested to do the real work\n      (let ((prologue-begin (typescript--function-prologue-beginning)))\n        (cond ((and prologue-begin (<= prologue-begin (point)))\n               (goto-char prologue-begin)\n               (re-search-forward \"\\\\_<function\")\n               (goto-char (match-beginning 0))\n               (typescript--forward-function-decl)\n               (forward-list))\n\n              (t (typescript--end-of-defun-nested)))))))\n\n(defun typescript--backward-syntactic-ws (&optional lim)\n  \"Simple implementation of `c-backward-syntactic-ws' for `typescript-mode'.\"\n  (save-restriction\n    (when lim (narrow-to-region lim (point-max)))\n\n    (let ((pos (point)))\n      (while (progn (forward-comment most-negative-fixnum)\n                    (/= (point)\n                        (prog1\n                            pos\n                          (setq pos (point)))))))))\n\n(defun typescript--forward-syntactic-ws (&optional lim)\n  \"Simple implementation of `c-forward-syntactic-ws' for `typescript-mode'.\"\n  (save-restriction\n    (when lim (narrow-to-region (point-min) lim))\n    (let ((pos (point)))\n      (while (progn\n               (forward-comment most-positive-fixnum)\n               (/= (point)\n                   (prog1\n                       pos\n                     (setq pos (point)))))))))\n\n;; Like (up-list -1), but only considers lists that end nearby\"\n(defun typescript--up-nearby-list ()\n  (save-restriction\n    ;; Look at a very small region so our computation time doesn't\n    ;; explode in pathological cases.\n    (narrow-to-region (max (point-min) (- (point) 500)) (point))\n    (up-list -1)))\n\n(defun typescript--inside-param-list-p ()\n  \"Return non-nil iff point is in a function parameter list.\"\n  (ignore-errors\n    (save-excursion\n      (typescript--up-nearby-list)\n      (and (looking-at \"(\")\n           (progn (forward-symbol -1)\n                  (or (looking-at \"function\")\n                      (progn (forward-symbol -1)\n                             (looking-at \"function\"))))))))\n\n(defun typescript--inside-dojo-class-list-p ()\n  \"Return non-nil iff point is in a Dojo multiple-inheritance class block.\"\n  (ignore-errors\n    (save-excursion\n      (typescript--up-nearby-list)\n      (let ((list-begin (point)))\n        (forward-line 0)\n        (and (looking-at typescript--dojo-class-decl-re)\n             (goto-char (match-end 0))\n             (looking-at \"\\\"\\\\s-*,\\\\s-*\\\\[\")\n             (eq (match-end 0) (1+ list-begin)))))))\n\n(defun typescript--syntax-begin-function ()\n  (when (< typescript--cache-end (point))\n    (goto-char (max (point-min) typescript--cache-end)))\n\n  (let ((pitem))\n    (while (and (setq pitem (car (typescript--backward-pstate)))\n                (not (eq 0 (typescript--pitem-paren-depth pitem)))))\n\n    (when pitem\n      (goto-char (typescript--pitem-h-begin pitem )))))\n\n(defun typescript--move-to-end-of-plain-string ()\n  \"If the point is in a plain string, move to the end of it.\n\nOtherwise, don't move.  A plain string is a string which is not a\ntemplate string.  The point is considered to be \\\"in\\\" a string if\nit is on the delimiters of the string, or any point inside.\n\nReturns point if the end of the string was found, or nil if the\nend of the string was not found.\"\n  (let ((end-position\n         (save-excursion\n           (let* ((syntax (syntax-ppss))\n                  (str-terminator (nth 3 syntax))\n                  ;; The 8th element will also be set if we are in a comment. So we\n                  ;; check str-terminator to protect against that.\n                  (string-start (and str-terminator\n                                     (nth 8 syntax))))\n             (if (and string-start\n                      (not (eq str-terminator ?`)))\n                 ;; We may already be at the end of the string.\n                 (if (and (eq (char-after) str-terminator)\n                          (not (eq (char-before) ?\\\\)))\n                     (point)\n                   ;; We just search forward and then check if the hit we get has a\n                   ;; string-start equal to ours.\n                   (cl-loop while (re-search-forward\n                                (concat \"\\\\(?:[^\\\\]\\\\|^\\\\)\\\\(\" (string str-terminator) \"\\\\)\")\n                                nil t)\n                         if (eq string-start\n                                (save-excursion (nth 8 (syntax-ppss (match-beginning 1)))))\n                         return (match-beginning 1)))\n               ;; If we are on the start delimiter then the value of syntax-ppss will look\n               ;; like we're not in a string at all, but this function considers the\n               ;; start delimiter to be \"in\" the string. We take care of this here.\n               (when (memq (char-after) '(?' ?\\\"))\n                 (forward-char)\n                 (typescript--move-to-end-of-plain-string)))))))\n    (when end-position\n      (goto-char end-position))))\n\n;;; Font Lock\n(defun typescript--make-framework-matcher (framework &rest regexps)\n  \"Helper function for building `typescript--font-lock-keywords'.\nCreate a byte-compiled function for matching a concatenation of\nREGEXPS, but only if FRAMEWORK is in `typescript-enabled-frameworks'.\"\n  (setq regexps (apply #'concat regexps))\n  (byte-compile\n   `(lambda (limit)\n      (when (memq (quote ,framework) typescript-enabled-frameworks)\n        (re-search-forward ,regexps limit t)))))\n\n(defvar typescript--tmp-location nil)\n(make-variable-buffer-local 'typescript--tmp-location)\n\n(defun typescript--forward-destructuring-spec (&optional func)\n  \"Move forward over a typescript destructuring spec.\nIf FUNC is supplied, call it with no arguments before every\nvariable name in the spec.  Return true iff this was actually a\nspec.  FUNC must preserve the match data.\"\n  (cl-case (char-after)\n    (?\\[\n     (forward-char)\n     (while\n         (progn\n           (forward-comment most-positive-fixnum)\n           (cond ((memq (char-after) '(?\\[ ?\\{))\n                  (typescript--forward-destructuring-spec func))\n\n                 ((eq (char-after) ?,)\n                  (forward-char)\n                  t)\n\n                 ((looking-at typescript--name-re)\n                  (and func (funcall func))\n                  (goto-char (match-end 0))\n                  t))))\n     (when (eq (char-after) ?\\])\n       (forward-char)\n       t))\n\n    (?\\{\n     (forward-char)\n     (forward-comment most-positive-fixnum)\n     (while\n         (when (looking-at typescript--objfield-re)\n           (goto-char (match-end 0))\n           (forward-comment most-positive-fixnum)\n           (and (cond ((memq (char-after) '(?\\[ ?\\{))\n                       (typescript--forward-destructuring-spec func))\n                      ((looking-at typescript--name-re)\n                       (and func (funcall func))\n                       (goto-char (match-end 0))\n                       t))\n                (progn (forward-comment most-positive-fixnum)\n                       (when (eq (char-after) ?\\,)\n                         (forward-char)\n                         (forward-comment most-positive-fixnum)\n                         t)))))\n     (when (eq (char-after) ?\\})\n       (forward-char)\n       t))))\n\n(defun typescript--variable-decl-matcher (limit)\n  \"Font-lock matcher for variable names in a variable declaration.\nThis is a cc-mode-style matcher that *always* fails, from the\npoint of view of font-lock.  It applies highlighting directly with\n`font-lock-apply-highlight'.\"\n  (condition-case nil\n      (save-restriction\n        (narrow-to-region (point-min) limit)\n\n        (let ((first t))\n          (forward-comment most-positive-fixnum)\n          (while\n              (and (or first\n                       (when (eq (char-after) ?,)\n                         (forward-char)\n                         (forward-comment most-positive-fixnum)\n                         t))\n                   (cond ((looking-at typescript--name-re)\n                          (font-lock-apply-highlight\n                           '(0 font-lock-variable-name-face))\n                          (goto-char (match-end 0)))\n\n                         ((save-excursion\n                            (typescript--forward-destructuring-spec))\n\n                          (typescript--forward-destructuring-spec\n                           (lambda ()\n                             (font-lock-apply-highlight\n                              '(0 font-lock-variable-name-face)))))))\n\n            (forward-comment most-positive-fixnum)\n            (when (eq (char-after) ?=)\n              (forward-char)\n              (typescript--forward-expression)\n              (forward-comment most-positive-fixnum))\n\n            (setq first nil))))\n\n    ;; Conditions to handle\n    (scan-error nil)\n    (end-of-buffer nil))\n\n  ;; Matcher always \"fails\"\n  nil)\n\n(defun typescript--function-argument-matcher (limit)\n  \"Font-lock matcher for variables in argument lists.\n\nBecause the syntax of the argument list is shared between\nfunctions, arrow functions and methods, this same matcher is used\nfor all of them.  The context for the search is set up as\nanchored matcher.\n\nThis is a cc-mode-style matcher that *always* fails, from the\npoint of view of font-lock.  It applies highlighting directly\nwith `font-lock-apply-highlight'.\"\n  (condition-case nil\n      (save-restriction\n        (widen)\n        (narrow-to-region (point-min) limit)\n        (while (re-search-forward\n                (rx (group\n                     (regexp \"[a-zA-Z_$]\\\\(?:\\\\s_\\\\|\\\\sw\\\\)*\")\n                     ;; name can be optionally followed by ? to mark\n                     ;; the argument optional\n                     (? \"?\"))\n                    (* whitespace)\n                    (group (or \",\" \":\" \")\"\n                               ;; last variable in the list with a\n                               ;; paren on next line and no hanging\n                               ;; comma.  extra logic is added to deal\n                               ;; with possible comments after the\n                               ;; variable.\n                               eol\n                               (and (* whitespace) (or \"//\" \"/*\") (* any) eol))))\n                nil t)\n          (font-lock-apply-highlight '(1 font-lock-variable-name-face t))\n\n          ;; If ender is a \":\" it means that the currently matched\n          ;; variable also has a type signature.\n          (let ((ender (match-string 2)))\n            ;; We need to skip the type specification.  The regexp\n            ;; basically either searches for the next thing which we\n            ;; believe is a parameter or the end of the argument list.\n            (when (equal ender \":\")\n              (let ((perform-match t))\n                (while (and perform-match\n                            (re-search-forward\n                             (rx (or\n                                  ;; variable without type at the end\n                                  ;; of line\n                                  (and \",\" eol)\n                                  ;; next thing is a functional\n                                  ;; argument, such as f:(x) => void\n                                  (and \"(\")\n                                  ;; closing of a function type argument.\n                                  ;; here, the type of `f'.\n                                  ;; (f: (x: number) => foo): void => { }\n                                  (and \")\" (? (* whitespace) \"=>\" (* whitespace)))\n                                  (and \",\"\n                                       (* whitespace)\n                                       (regexp \"[a-zA-Z_$]\\\\(?:\\\\s_\\\\|\\\\sw\\\\)*\")\n                                       ;; optional ? to mark the\n                                       ;; argument optional\n                                       (? \"?\")\n                                       (group (or \":\" \")\")))))\n                             nil t))\n                  ;; In case the skipped type was the end of a\n                  ;; function type argument, the next token is the\n                  ;; return type of the inner function, so we need to\n                  ;; match but not fontify the next \"name\" (which\n                  ;; really is the type).\n                  (if (string-match-p \"=>\" (match-string 0))\n                      (setq perform-match t)\n                    (goto-char (match-beginning 0))\n                    (setq perform-match nil))))))))\n    ;; conditions to handle\n    (scan-error nil)\n    (end-of-buffer nil))\n  nil)\n\n(defun typescript--in-documentation-comment-p ()\n  \"Reports whether point is inside a documentation comment.\"\n  (let ((parse (syntax-ppss)))\n    (and\n     (nth 4 parse) ;; Inside a comment ...\n     (save-match-data\n       (save-excursion\n         (goto-char (nth 8 parse))\n         (looking-at \"/\\\\*\\\\*\")))))) ;; ... which starts with /**\n\n(defun typescript--documentation-font-lock-helper (re limit)\n  \"This is a helper macro that determines whether jsdoc highlighting is to be applied,\nand searches for the next token to be highlighted.\"\n  (cl-loop while (re-search-forward re limit t)\n        if (typescript--in-documentation-comment-p)\n        return (point)))\n\n(defun typescript--jsdoc-param-matcher (limit)\n  \"Font-lock mode matcher that finds jsdoc parameter tags in documentation.\"\n  (typescript--documentation-font-lock-helper typescript-jsdoc-param-tag-regexp limit))\n\n(defun typescript--jsdoc-typed-tag-matcher (limit)\n  \"Font-lock mode matcher that finds jsdoc typed tags in documentation.\"\n  (typescript--documentation-font-lock-helper typescript-jsdoc-typed-tag-regexp limit))\n\n(defun typescript--jsdoc-arg-tag-matcher (limit)\n  \"Font-lock mode matcher that finds jsdoc tags that take one argument in documentation.\"\n  (typescript--documentation-font-lock-helper typescript-jsdoc-arg-tag-regexp limit))\n\n(defun typescript--jsdoc-empty-tag-matcher (limit)\n  \"Font-lock mode matcher that finds jsdoc tags without argument in documentation.\"\n  (typescript--documentation-font-lock-helper typescript-jsdoc-empty-tag-regexp limit))\n\n(defun typescript--typedoc-link-matcher (limit)\n  \"Font-lock mode matcher that finds typedoc links in documentation.\"\n  (typescript--documentation-font-lock-helper typescript-typedoc-link-tag-regexp limit))\n\n(defun typescript--typedoc-literal-markup-matcher (limit)\n  \"Font-lock mode matcher that finds typedoc literal markup in documentation.\"\n  (typescript--documentation-font-lock-helper typescript-typedoc-literal-markup-regexp limit))\n\n(defun typescript--tslint-flag-matcher (limit)\n  \"Font-lock mode matcher that finds tslint flags in comments.\"\n  (cl-loop while (re-search-forward typescript-tslint-flag-regexp limit t)\n        if (nth 4 (syntax-ppss (match-beginning 1)))\n        return (point)))\n\n(defconst typescript--font-lock-keywords-3\n  `(\n    ,@typescript--font-lock-keywords-2\n\n    ;; Remove the fontification of keywords and built-ins when they\n    ;; are keys in an interface, object or class.\n    (,(rx \"{\")\n     (,(concat \"\\\\(\" typescript--keyword-re \"\\\\):\")\n      (save-excursion (ignore-errors (up-list)) (point))\n      nil\n      (1 'default t t)))\n\n    (typescript--jsdoc-param-matcher (1 'typescript-jsdoc-tag t t)\n                                     (2 'typescript-jsdoc-type t t)\n                                     (3 'typescript-jsdoc-value t t))\n\n    (typescript--jsdoc-typed-tag-matcher (1 'typescript-jsdoc-tag t t)\n                                         (2 'typescript-jsdoc-type t t))\n\n    (typescript--jsdoc-arg-tag-matcher (1 'typescript-jsdoc-tag t t)\n                                       (2 'typescript-jsdoc-value t t))\n\n    (typescript--jsdoc-empty-tag-matcher (1 'typescript-jsdoc-tag t t))\n\n    (typescript--typedoc-link-matcher (0 'typescript-jsdoc-value t))\n\n    (typescript--typedoc-literal-markup-matcher\n     (0 'typescript-jsdoc-value t))\n\n    (typescript--tslint-flag-matcher\n     (1 'font-lock-preprocessor-face t))\n\n    (\"\\\\.\\\\(prototype\\\\)\\\\_>\"\n     (1 'font-lock-constant-face))\n\n    (,(rx symbol-start \"class\" (+ space) (group (+ (or (syntax word) (syntax symbol)))))\n     (1 'font-lock-type-face))\n\n    (,(rx symbol-start \"extends\" (+ space) (group (+ (or (syntax word) (syntax symbol)))))\n     (1 'font-lock-type-face))\n\n    (,(rx symbol-start \"implements\" (+ space))\n     (,(rx symbol-start (+ (syntax word))) nil nil (0 'font-lock-type-face)))\n\n    (,(rx symbol-start \"interface\" (+ space) (group (+ (or (syntax word) (syntax symbol)))))\n     (1 'font-lock-type-face))\n\n    (,(rx symbol-start \"type\" (+ space) (group (+ (or (syntax word) (syntax symbol)))))\n     (1 'font-lock-type-face))\n\n    (,(rx symbol-start \"enum\" (+ space) (group (+ (or (syntax word) (syntax symbol)))))\n     (1 'font-lock-type-face))\n\n    ;; Highlights class being declared, in parts\n    (typescript--class-decl-matcher\n     ,(concat \"\\\\(\" typescript--name-re \"\\\\)\\\\(?:\\\\.\\\\|.*$\\\\)\")\n     (goto-char (match-beginning 1))\n     nil\n     (1 'font-lock-type-face))\n\n    ;; Highlights parent class, in parts, if available\n    (typescript--class-decl-matcher\n     ,(concat \"\\\\(\" typescript--name-re \"\\\\)\\\\(?:\\\\.\\\\|.*$\\\\)\")\n     (if (match-beginning 2)\n         (progn\n           (setq typescript--tmp-location (match-end 2))\n           (goto-char typescript--tmp-location)\n           (insert \"=\")\n           (goto-char (match-beginning 2)))\n       (setq typescript--tmp-location nil)\n       (goto-char (point-at-eol)))\n     (when typescript--tmp-location\n       (save-excursion\n         (goto-char typescript--tmp-location)\n         (delete-char 1)))\n     (1 'font-lock-type-face))\n\n    ;; Highlights parent class\n    (typescript--class-decl-matcher\n     (2 'font-lock-type-face nil t))\n\n    ;; Dojo needs its own matcher to override the string highlighting\n    (,(typescript--make-framework-matcher\n       'dojo\n       \"^\\\\s-*dojo\\\\.declare\\\\s-*(\\\"\"\n       \"\\\\(\" typescript--dotted-name-re \"\\\\)\"\n       \"\\\\(?:\\\"\\\\s-*,\\\\s-*\\\\(\" typescript--dotted-name-re \"\\\\)\\\\)?\")\n     (1 'font-lock-type-face t)\n     (2 'font-lock-type-face nil t))\n\n    ;; Match Dojo base classes. Of course Mojo has to be different\n    ;; from everything else under the sun...\n    (,(typescript--make-framework-matcher\n       'dojo\n       \"^\\\\s-*dojo\\\\.declare\\\\s-*(\\\"\"\n       \"\\\\(\" typescript--dotted-name-re \"\\\\)\\\"\\\\s-*,\\\\s-*\\\\[\")\n     ,(concat \"[[,]\\\\s-*\\\\(\" typescript--dotted-name-re \"\\\\)\\\\s-*\"\n              \"\\\\(?:\\\\].*$\\\\)?\")\n     (backward-char)\n     (end-of-line)\n     (1 'font-lock-type-face))\n\n    ;; continued Dojo base-class list\n    (,(typescript--make-framework-matcher\n       'dojo\n       \"^\\\\s-*\" typescript--dotted-name-re \"\\\\s-*[],]\")\n     ,(concat \"\\\\(\" typescript--dotted-name-re \"\\\\)\"\n              \"\\\\s-*\\\\(?:\\\\].*$\\\\)?\")\n     (if (save-excursion (backward-char)\n                         (typescript--inside-dojo-class-list-p))\n         (forward-symbol -1)\n       (end-of-line))\n     (end-of-line)\n     (1 'font-lock-type-face))\n\n    ;; variable declarations\n    ,(list\n      (concat \"\\\\_<\\\\(const\\\\|var\\\\|let\\\\)\\\\_>\\\\|\" typescript--basic-type-re)\n      (list #'typescript--variable-decl-matcher nil nil nil))\n\n    ;; class instantiation\n    (,(concat \"\\\\_<new\\\\_>\\\\s-+\\\\(\" typescript--dotted-name-re \"\\\\)\")\n     (1 'font-lock-type-face))\n\n    ;; instanceof\n    (,(concat \"\\\\_<instanceof\\\\_>\\\\s-+\\\\(\" typescript--dotted-name-re \"\\\\)\")\n     (1 'font-lock-type-face))\n\n    ;; formal parameters in \"function\" function call\n    ;; function helloWorld(a: number, b: Promise<number>): void { }\n    ,(list\n      (concat\n       \"\\\\_<function\\\\_>\\\\(\\\\s-+\" typescript--name-re \"\\\\)?\\\\s-*\\\\(<.*>\\\\)?\\\\s-*(\\\\s-*\"\n       \"\\\\(?:$\\\\|\" typescript--name-start-re \"\\\\)\")\n      `(typescript--function-argument-matcher\n        (prog1 (save-excursion (ignore-errors (up-list)) (point))\n          (backward-char))\n        nil\n        nil))\n\n    ;; formal parameters in arrow function\n    ;; const helloWorld = (a: number, b: Promise<number>): void => { }\n    ,(list\n      (rx (group \"=>\") (* whitespace) (? eol) (* whitespace) \"{\")\n      '(1 font-lock-keyword-face)\n      `(typescript--function-argument-matcher\n        (prog1 (progn\n                 (backward-char)\n                 (typescript--backward-to-parameter-list)\n                 (point))\n          (backward-sexp))\n        (re-search-forward \"{\" nil t)\n        nil))\n\n    ;; formal parameters in method definitions\n    ;; class Foo { helloWorld(a: number, b: Promise<number>): void { } }\n    ,(list\n      typescript--function-call-re\n      `(typescript--function-argument-matcher\n        (let ((point-orig (point))\n              (is-method-def\n               (ignore-errors\n                 (up-list)\n                 (and\n                  (or\n                   ;; After the \"argument list\" is a bracket, this is\n                   ;; either a special form (if, while...) or a method\n                   ;; declaration.\n                   (looking-at-p (rx (* (or whitespace ?\\n)) \"{\"))\n                   ;; After the \"argument list\" is a colon, this is\n                   ;; either a method declaration with a return type\n                   ;; annotation or ternary form.  We need to discard\n                   ;; the ternary form case.\n                   (and\n                    (looking-at-p (rx (* (or whitespace ?\\n)) \":\"))\n                    (save-excursion\n                      (backward-sexp 2)\n                      (skip-syntax-backward \" >\")\n                      (not (eq (char-before) ??)))))\n                  ;; HACK: here we check the fontification of\n                  ;; the \"function name\".  Because the keywords\n                  ;; are fontified before this check runs, a\n                  ;; keyword would already have been fontified\n                  ;; and therefore we can conclude it is not a\n                  ;; function/method definition.\n                  (save-excursion\n                    (backward-sexp)\n                    (backward-word)\n                    (not (memq\n                          'font-lock-keyword-face\n                          (face-at-point nil t))))))))\n          (if is-method-def\n              (prog1 (point) (goto-char point-orig))\n            (point)))\n        nil\n        nil)))\n  \"Level three font lock for `typescript-mode'.\")\n\n(defun typescript--flyspell-mode-predicate ()\n  \"A custom predicate to help `flyspell-prog-mode' determine whether a word should be checked.\"\n  ;; We depend on fontification for our results. font-lock-ensure is defined on\n  ;; Emacs 25 and over. Earlier versions use font-lock-fontify-buffer.\n  (if (fboundp 'font-lock-ensure)\n      (font-lock-ensure)\n    (font-lock-fontify-buffer))\n  (and\n   ;; Check with the default method that flyspell provides.\n   (flyspell-generic-progmode-verify)\n\n   ;;\n   ;; And eliminate cases specific to our mode we don't want to have\n   ;; spell-checked.\n   ;;\n\n   ;; Don't check the module names in import statements.\n   (save-excursion\n     (not (let* ((parse (syntax-ppss (1- (point))))\n                 (string-start-pos (and (nth 3 parse)\n                                        (nth 8 parse))))\n            (and string-start-pos\n                 (save-match-data\n                   ;; Move to back to the start of the string, then past any ws\n                   ;; and then past any non-ws to see if we have \"from\" or \"import\".\n                   (goto-char string-start-pos)\n                   (typescript--backward-syntactic-ws)\n                   (skip-syntax-backward \"^-\" (point-at-bol))\n                   (looking-at \"from\\\\|import\\\\s-\"))))))))\n\n(defun typescript--inside-pitem-p (pitem)\n  \"Return whether point is inside the given pitem's header or body.\"\n  (typescript--ensure-cache)\n  (cl-assert (typescript--pitem-h-begin pitem))\n  (cl-assert (typescript--pitem-paren-depth pitem))\n\n  (and (> (point) (typescript--pitem-h-begin pitem))\n       (or (null (typescript--pitem-b-end pitem))\n           (> (typescript--pitem-b-end pitem) (point)))))\n\n(defun typescript--parse-state-at-point ()\n  \"Parse the typescript program state at point.\nReturn a list of `typescript--pitem' instances that apply to point, most\nspecific first.  In the worst case, the current toplevel instance\nwill be returned.\"\n  (save-excursion\n    (save-restriction\n      (widen)\n      (typescript--ensure-cache)\n      (let* ((bound (if (eobp) (point) (1+ (point))))\n             (pstate (or (save-excursion\n                           (typescript--backward-pstate))\n                         (list typescript--initial-pitem))))\n\n        ;; Loop until we either hit a pitem at BOB or pitem ends after\n        ;; point (or at point if we're at eob)\n        (cl-loop for pitem = (car pstate)\n              until (or (eq (typescript--pitem-type pitem)\n                            'toplevel)\n                        (typescript--inside-pitem-p pitem))\n              do (pop pstate))\n\n        pstate))))\n\n(defun typescript--syntactic-context-from-pstate (pstate)\n  \"Return the typescript syntactic context corresponding to PSTATE.\"\n  (let ((type (typescript--pitem-type (car pstate))))\n    (cond ((memq type '(function macro))\n           type)\n          ((consp type)\n           'class)\n          (t 'toplevel))))\n\n(defun typescript-syntactic-context ()\n  \"Return the typescript syntactic context at point.\nWhen called interactively, also display a message with that\ncontext.\"\n  (interactive)\n  (let* ((syntactic-context (typescript--syntactic-context-from-pstate\n                             (typescript--parse-state-at-point))))\n\n    (when (called-interactively-p 'interactive)\n      (message \"Syntactic context: %s\" syntactic-context))\n\n   syntactic-context))\n\n(defun typescript--class-decl-matcher (limit)\n  \"Font lock function used by `typescript-mode'.\nThis performs fontification according to `typescript--class-styles'.\"\n  (cl-loop initially (typescript--ensure-cache limit)\n        while (re-search-forward typescript--quick-match-re limit t)\n        for orig-end = (match-end 0)\n        do (goto-char (match-beginning 0))\n        if (cl-loop for style in typescript--class-styles\n                 for decl-re = (plist-get style :class-decl)\n                 if (and (memq (plist-get style :framework)\n                               typescript-enabled-frameworks)\n                         (memq (typescript-syntactic-context)\n                               (plist-get style :contexts))\n                         decl-re\n                         (looking-at decl-re))\n                 do (goto-char (match-end 0))\n                 and return t)\n        return t\n        else do (goto-char orig-end)))\n\n(defun typescript--match-subst-in-quotes (limit)\n  \"Match dollar substitutions inside backticks.\"\n  (catch 'done\n    (while (re-search-forward\n            ;; `rx' is cool, mkay.\n            (rx (or line-start (not (any \"\\\\\")))\n                (group \"${\")\n                (group (+? nonl))\n                (group \"}\"))\n            limit t)\n      (let ((string-delim (nth 3 (syntax-ppss))))\n        (when (and string-delim (= string-delim 96))\n          (throw 'done (point)))))))\n\n(defconst typescript--font-lock-keywords-4\n  `(\n    ;; highlights that override previous levels\n    ;;\n\n    ;; special highlight for `this' keyword\n    (\"\\\\(this\\\\)\\\\.\"\n     (1 'typescript-this-face))\n\n    (,typescript--access-modifier-re (1 'typescript-access-modifier-face))\n    (,typescript--basic-type-re (1 'typescript-primitive-face))\n\n    ;; generics support\n    ,(list\n      (concat typescript--name-re \"\\\\s-*\" \"<\\\\s-*\" typescript--name-start-re)\n      (list (concat \"\\\\(\" typescript--name-re \"\\\\)\\\\(\\\\s-*>[^<]*\\\\)?\")\n            '(backward-char)\n            '(end-of-line)\n            '(1 font-lock-type-face)))\n\n    ;; type-highlighting in variable/parameter declarations\n    ;; supports a small variety of common declarations:\n    ;; - let a: SomeType;\n    ;; - private b: SomeType;\n    ;; - private someFunc(var: SomeType) {\n    ;; - private array: SomeType[]\n    ;; - private generic: SomeType<Foo>\n    ;; - private genericArray: SomeType<Foo>[]\n    ;; - function testFunc(): SomeType<> {\n    ;; - function testFunc(a): a is SomeType<> {\n    ;; - () => SomeType\n    ;; TODO: namespaced classes!\n    ,(list\n      (concat \"\\\\(?::\\\\|=>\\\\)\\\\s-\\\\(?:\\\\s-*\\\\(\" typescript--name-re \"\\\\)\\\\s-*\\\\(is\\\\)\\\\s-*\\\\)?\" \"\\\\(\" typescript--type-name-re \"\\\\)\\\\(<\" typescript--type-name-re \">\\\\)?\\\\(\\\\[\\\\]\\\\)?\\\\([,;]\\\\)?\\\\s-*{?\")\n      '(1 'font-lock-variable-name-face nil t)\n      '(2 'font-lock-keyword-face nil t)\n      '(3 'font-lock-type-face))\n\n    ;; type-casts\n    ,(list\n      (concat \"<\\\\(\" typescript--type-name-re \"\\\\)>\")\n      '(1 'font-lock-type-face))\n\n    ;; highlights that append to previous levels\n    ;;\n    ,@typescript--font-lock-keywords-3\n\n    (,typescript--decorator-re (1 'font-lock-function-call-face))\n    (,typescript--function-call-re (1 (typescript--function-face)))\n    (,(concat \"\\\\(?:\\\\.\\\\s-*\\\\)\" typescript--function-call-re)\n     (1 'font-lock-function-call-face t))\n    (,typescript--builtin-re (1 'font-lock-type-face))\n\n    ;; arrow function\n    (\"\\\\(=>\\\\)\"\n     (1 'font-lock-keyword-face))\n\n    (typescript--match-subst-in-quotes\n     (1 'font-lock-keyword-face t)\n     (2 'default t)\n     (3 'font-lock-keyword-face t)))\n  \"Level four font lock for `typescript-mode'.\")\n\n(defun typescript--function-face ()\n  \"Return the face to use depending if it's a definition or a call.\nPoint is assumed to be right after the open paren.\"\n  (save-excursion\n    (forward-char -1)\n    (if (condition-case nil\n            (progn\n              (forward-sexp 1)\n              (forward-comment (point-max))\n              (memq (char-after) '(?: ?\\{)))\n          (scan-error nil))\n        ;; Looks like a declaration/definition.\n        'font-lock-function-name-face\n      ;; Probably just a call.\n      'font-lock-function-call-face)))\n\n(defconst typescript--font-lock-keywords\n  '(typescript--font-lock-keywords-4 typescript--font-lock-keywords-1\n                                   typescript--font-lock-keywords-2\n                                   typescript--font-lock-keywords-3\n                                   typescript--font-lock-keywords-4)\n  \"Font lock keywords for `typescript-mode'.  See `font-lock-keywords'.\")\n\n;;; Propertize\n\n;;\n;; The propertize code was adapted from:\n;; https://github.com/emacs-mirror/emacs/blob/489d6466372f488adc53897435fff290394b62f7/lisp/progmodes/js.el\n;;\n\n(defconst typescript--syntax-propertize-regexp-regexp\n  (rx\n   ;; Start of regexp.\n   \"/\"\n   (0+ (or\n        ;; Match characters outside of a character class.\n        (not (any ?\\[ ?/ ?\\\\))\n        ;; Match backslash quoted characters.\n        (and \"\\\\\" not-newline)\n        ;; Match character class.\n        (and\n         \"[\"\n         (0+ (or\n              (not (any ?\\] ?\\\\))\n              (and \"\\\\\" not-newline)))\n         \"]\")))\n   (group (zero-or-one \"/\")))\n  \"Regular expression matching a JavaScript regexp literal.\")\n\n(defun typescript-syntax-propertize-regexp (end)\n  (let ((ppss (syntax-ppss)))\n    (when (eq (nth 3 ppss) ?/)\n      ;; A /.../ regexp.\n      (goto-char (nth 8 ppss))\n      (when (looking-at typescript--syntax-propertize-regexp-regexp)\n        ;; Don't touch text after END.\n        (when (> end (match-end 1))\n          (setq end (match-end 1)))\n        (put-text-property (match-beginning 1) end\n                           'syntax-table (string-to-syntax \"\\\"/\"))\n        (goto-char end)))))\n\n(defun typescript-syntax-propertize (start end)\n  ;; JavaScript allows immediate regular expression objects, written /.../.\n  (funcall\n   (syntax-propertize-rules\n    ;; Distinguish /-division from /-regexp chars (and from /-comment-starter).\n    ;; FIXME: Allow regexps after infix ops like + ...\n    ;; https://developer.mozilla.org/en/JavaScript/Reference/Operators\n    ;; We can probably just add +, -, <, >, %, ^, ~, ?, : at which\n    ;; point I think only * and / would be missing which could also be added,\n    ;; but need care to avoid affecting the // and */ comment markers.\n    (\"\\\\(?:^\\\\|[=([{,:;|&!]\\\\|\\\\_<return\\\\_>\\\\)\\\\(?:[ \\t]\\\\)*\\\\(/\\\\)[^/*]\"\n     (1 (ignore\n     (forward-char -1)\n         (when (or (not (memq (char-after (match-beginning 0)) '(?\\s ?\\t)))\n                   ;; If the / is at the beginning of line, we have to check\n                   ;; the end of the previous text.\n                   (save-excursion\n                     (goto-char (match-beginning 0))\n                     (forward-comment (- (point)))\n                     (memq (char-before)\n                           (eval-when-compile (append \"=({[,:;\" '(nil))))))\n           (put-text-property (match-beginning 1) (match-end 1)\n                              'syntax-table (string-to-syntax \"\\\"/\"))\n           (typescript-syntax-propertize-regexp end)))))\n    ;; Hash-bang at beginning of buffer.\n    (\"\\\\`\\\\(#\\\\)!\" (1 \"< b\")))\n   start end))\n\n;;; Indentation\n\n(defconst typescript--possibly-braceless-keyword-re\n  (typescript--regexp-opt-symbol\n   '(\"catch\" \"do\" \"else\" \"finally\" \"for\" \"if\" \"try\" \"while\" \"with\"))\n  \"Regexp matching keywords optionally followed by an opening brace.\")\n\n(defconst typescript--indent-keyword-re\n  (typescript--regexp-opt-symbol '(\"in\" \"instanceof\"))\n  \"Regexp matching keywords that affect indentation of continued expressions.\")\n\n(defconst typescript--indent-operator-re\n  (concat \"[-+*/%<>=&^|?:.]\\\\([^-+*/]\\\\|$\\\\)\\\\|\" typescript--indent-keyword-re)\n  \"Regexp matching operators that affect indentation of continued expressions.\")\n\n;;\n;; We purposely do not allow the plus symbol as a prefix here, as this\n;; regex is used to check number literal in type annotations, and TS\n;; does not allow to use a plus symbol to prefix numbers there: you\n;; can use 1, but not +1 in a type annotation.\n;;\n;; This is meant to match NaN, floats, decimals, the two infinities\n;; and numbers recorded in binary, octal and hex.\n;;\n;; This regular expression was derived from:\n;; https://stackoverflow.com/a/30987109/\n;;\n(defconst typescript--number-literal-re\n  \"\\\\(?:NaN\\\\|-?\\\\(?:0[Bb][01]+\\\\|0[Oo][0-7]+\\\\|0[Xx][0-9a-fA-F]+\\\\|Infinity\\\\|\\\\(?:[[:digit:]]*\\\\.[[:digit:]]+\\\\|[[:digit:]]+\\\\)\\\\(?:[Ee][+-]?[[:digit:]]+\\\\)?\\\\)\\\\)\"\n  \"Regexp that matches number literals.\")\n\n(defconst typescript--reserved-start-keywords\n  '(\"const\" \"export\" \"function\" \"let\" \"var\")\n  \"These keywords cannot be variable or type names and start a new sentence.\nNote that the \\\"import\\\" keyword can be a type import since TS2.9, so it might\nnot start a sentence!\")\n\n(defconst typescript--reserved-start-keywords-re\n  (typescript--regexp-opt-symbol '(\"const\" \"export\" \"function\" \"let\" \"var\"))\n  \"A regular expression matching `typescript--reserved-start-keywords'.\")\n\n(defconst typescript--type-vs-ternary-re\n  (concat \"[?]\\\\|\" (typescript--regexp-opt-symbol\n                    (append typescript--reserved-start-keywords\n                            '(\"as\" \"class\" \"interface\" \"private\" \"public\" \"readonly\"))))\n  \"Keywords/Symbols that help tell apart colon for types vs ternary operators.\")\n\n(defun typescript--search-backward-matching-angle-bracket-inner (depth)\n  \"Auxiliary function for `typescript--search-backward-matching-angle-bracket'.\nDEPTH indicates how nested we think we are: it increases when we cross closing\nbrackets, and decreases when we cross opening brackets.\"\n  ;; We look backwards for a \"<\" that would correspond to the \">\" we started\n  ;; from.  However, there is no guarantee that it exists, since our \">\" could\n  ;; be a greater-than operation.  Some symbols will make it clear that we are\n  ;; *not* in a type annotation, so we can return nil.  Otherwise, we keep\n  ;; looking for the matching one.\n  (or (<= depth 0)\n      (and\n       ;; If we cross over a reserved start keyword, we abandon hope of finding\n       ;; a matching angle bracket.  This prevents extreme recursion depths.\n       (typescript--re-search-backward (concat \"[<>]\\\\|\" typescript--reserved-start-keywords-re) nil t)\n       (cl-case (char-after)\n         (?< (typescript--search-backward-matching-angle-bracket-inner (- depth 1)))\n         (?> (typescript--search-backward-matching-angle-bracket-inner (+ depth 1)))))))\n\n(defun typescript--search-backward-matching-angle-bracket ()\n  \"Search for matching \\\"<\\\" preceding a starting \\\">\\\".\nDEPTH indicates how nested we think we are.  Assumes the starting position is\nright before the closing \\\">\\\".  Returns nil when a match was not found,\notherwise returns t and the current position is right before the matching\n\\\"<\\\".\"\n  (typescript--search-backward-matching-angle-bracket-inner 1))\n\n(defun typescript--re-search-backward-ignoring-angle-brackets ()\n  \"Search backwards, jumping over text within angle brackets.\nSearches specifically for any of \\\"=\\\", \\\"}\\\", and \\\"type\\\".\"\n  (and\n   (typescript--re-search-backward \"[>=}]\\\\|\\\\_<type\\\\_>\" nil t)\n   (or (not (looking-at \">\"))\n       (and\n        (typescript--search-backward-matching-angle-bracket)\n        (typescript--re-search-backward-ignoring-angle-brackets)))))\n\n(defun typescript--looking-at-operator-p ()\n  \"Return non-nil if point is on a typescript operator, other than a comma.\"\n  (save-match-data\n    (and (looking-at typescript--indent-operator-re)\n         (or (not (looking-at \":\"))\n             (save-excursion\n               (backward-sexp)\n               (and\n                (typescript--re-search-backward \"[?:{]\\\\|\\\\_<case\\\\_>\" nil t)\n                (looking-at \"?\"))))\n         ;; Do not identify forward slashes appearing in a \"list\" as\n         ;; an operator. The lists are: arrays, or lists of\n         ;; arguments. In this context, they must be part of regular\n         ;; expressions, and not math operators.\n         (not (and (looking-at \"/\")\n                   (save-excursion\n                     (typescript--backward-syntactic-ws)\n                     (memq (char-before) '(?, ?\\[ ?\\()))))\n         ;; Do not identify methods, or fields, that are named \"in\" or\n         ;; \"instanceof\" as being operator keywords.\n         (not (and\n               (looking-at typescript--indent-keyword-re)\n               (save-excursion\n                 (typescript--backward-syntactic-ws)\n                 (memq (char-before) '(?, ?{ ?} ?\\;)))))\n         ;; Do not identify the symbol > if it is likely part of a type argument\n         ;; T<A>, but identify it if it is likely a greater-than symbol. This is\n         ;; a hard problem in the absence of semicolons, see:\n         ;; https://github.com/ananthakumaran/typescript.el/issues/81\n         (not (and\n               (looking-at \">\")\n               (save-excursion\n                 (and\n                  (typescript--search-backward-matching-angle-bracket)\n                  ;; If we made it here, we found a candidate matching opening\n                  ;; angle bracket. We still need to guess whether it actually\n                  ;; is one, and not a spurious less-than operator!\n\n                  ;; Look backwards for the first of:\n                  ;; - one of the symbols: = :\n                  ;; - or a TypeScript keyword\n                  ;; Depending on what comes first, we can make an educated\n                  ;; guess on the nature of our \">\" of interest.\n                  (typescript--re-search-backward (concat \"[=:]\\\\|\" typescript--keyword-re) nil t)\n                  (or\n                   ;; If the previous keyword is \"as\", definitely a type.\n                   (looking-at \"\\\\_<as\\\\_>\")\n                   ;; Same goes for type imports.\n                   (looking-at \"\\\\_<import\\\\_>\")\n                   ;; A colon could be either a type symbol, or a ternary\n                   ;; operator, try to guess which.\n                   (and (looking-at \":\")\n                        (typescript--re-search-backward typescript--type-vs-ternary-re nil t)\n                        (not (looking-at \"?\")))\n                   ;; This final check lets us distinguish between a\n                   ;; 2-argument type \"t < a , b > ...\" and a use of the \",\"\n                   ;; operator between two comparisons \"t < a , b > ...\".\n                   ;; Looking back a little more lets us guess.\n                   (and (looking-at \"=\")\n                        (typescript--re-search-backward-ignoring-angle-brackets)\n                        (looking-at \"\\\\_<type\\\\_>\")))))))\n         (not (and\n               (looking-at \"*\")\n               ;; Generator method (possibly using computed property).\n               (looking-at (concat \"\\\\* *\\\\(?:\\\\[\\\\|\" typescript--name-re\n                                   \" *(\\\\)\"))\n               (save-excursion\n                 (typescript--backward-syntactic-ws)\n                 ;; We might misindent some expressions that would\n                 ;; return NaN anyway.  Shouldn't be a problem.\n                 (memq (char-before) '(?, ?} ?{ ?\\;))))))))\n\n\n(defun typescript--continued-expression-p ()\n  \"Return non-nil if the current line continues an expression.\"\n  (save-excursion\n    (back-to-indentation)\n    (let ((list-start (nth 1 (syntax-ppss))))\n      (and\n       ;; This not clause is there to eliminate degenerate cases where we have\n       ;; something that looks like a continued expression but we are in fact at\n       ;; the beginning of the expression. Example: in `if (a) { .q(1)` when the\n       ;; point is on the dot, the expression that follows looks like a member\n       ;; expression but the object on which it is a member is missing. If we\n       ;; naively treat this as a continued expression, we run into trouble\n       ;; later. (An infinite loop.)\n       (not (and list-start\n                 (save-excursion\n                   (typescript--backward-syntactic-ws)\n                   (backward-char)\n                   (eq (point) list-start))))\n       ;; Don't identify the spread syntax or rest operator as a \"continuation\".\n       (not (looking-at \"\\\\.\\\\.\\\\.\"))\n       (or (typescript--looking-at-operator-p)\n           (and (progn\n                  (typescript--backward-syntactic-ws)\n                  (or (bobp) (backward-char))\n                  (and (> (point) (point-min))\n                       (save-excursion (backward-char) (not (looking-at \"[/*]/\")))\n                       (typescript--looking-at-operator-p)\n                       (and (progn (backward-char)\n                                   (not (looking-at \"++\\\\|--\\\\|/[/*]\"))))))))))))\n\n(cl-defun typescript--compute-member-expression-indent ()\n  \"Determine the indent of a member expression.\n\nThis function must be called with point located at the dot that\nstarts the member expression.\n\"\n  ;; Find the line that has the object from which we are getting thismember.\n  ;; And set an indent relative to that.\n  (while (looking-at \"\\\\.\")\n    (typescript--backward-syntactic-ws)\n    (while (eq (char-before) ?\\;)\n      (backward-char))\n    (when (memq (char-before) '(?\\? ?\\!))\n      (backward-char))\n    (while (memq (char-before) '(?\\] ?} ?\\) ?>))\n      (if (not (eq (char-before) ?>))\n          (backward-list)\n        (backward-char)\n        (typescript--backward-over-generic-parameter-list))\n      (typescript--backward-syntactic-ws))\n    (if (looking-back typescript--dotted-name-re nil)\n        (back-to-indentation)\n      (typescript--forward-syntactic-ws)))\n  (+ (current-column) typescript-indent-level))\n\n(defun typescript--end-of-do-while-loop-p ()\n  \"Return non-nil if point is on the \\\"while\\\" of a do-while statement.\nOtherwise, return nil.  A braceless do-while statement spanning\nseveral lines requires that the start of the loop is indented to\nthe same column as the current line.\"\n  (interactive)\n  (save-excursion\n    (save-match-data\n      (when (looking-at \"\\\\s-*\\\\_<while\\\\_>\")\n    (if (save-excursion\n          (skip-chars-backward \"[ \\t\\n]*}\")\n          (looking-at \"[ \\t\\n]*}\"))\n        (save-excursion\n          (backward-list) (forward-symbol -1) (looking-at \"\\\\_<do\\\\_>\"))\n      (typescript--re-search-backward \"\\\\_<do\\\\_>\" (point-at-bol) t)\n      (or (looking-at \"\\\\_<do\\\\_>\")\n          (let ((saved-indent (current-indentation)))\n        (while (and (typescript--re-search-backward \"^\\\\s-*\\\\_<\" nil t)\n                (/= (current-indentation) saved-indent)))\n        (and (looking-at \"\\\\s-*\\\\_<do\\\\_>\")\n             (not (typescript--re-search-forward\n               \"\\\\_<while\\\\_>\" (point-at-eol) t))\n             (= (current-indentation) saved-indent)))))))))\n\n\n(defun typescript--ctrl-statement-indentation ()\n  \"Helper function for `typescript--proper-indentation'.\nReturn the proper indentation of the current line if it starts\nthe body of a control statement without braces; otherwise, return\nnil.\"\n  (save-excursion\n    (back-to-indentation)\n    (when (save-excursion\n            (and (not (eq (point-at-bol) (point-min)))\n                 (not (looking-at \"[{]\"))\n                 (progn\n                   (typescript--re-search-backward \"[[:graph:]]\" nil t)\n                   (or (eobp) (forward-char))\n                   (when (= (char-before) ?\\)) (backward-list))\n                   (skip-syntax-backward \" \")\n                   (skip-syntax-backward \"w_\")\n                   (and\n                    (looking-at typescript--possibly-braceless-keyword-re)\n                    ;; If preceded by period, it's a method call.\n                    (not (= (char-before) ?.))))\n                 (not (typescript--end-of-do-while-loop-p))))\n      (save-excursion\n        (goto-char (match-beginning 0))\n        (+ (current-indentation) typescript-indent-level)))))\n\n(defun typescript--get-c-offset (symbol anchor)\n  (let ((c-offsets-alist\n         (list (cons 'c typescript-comment-lineup-func))))\n    (c-get-syntactic-indentation (list (cons symbol anchor)))))\n\n(defun typescript--backward-over-generic-parameter-list ()\n  \"Search backward for the start of a generic's parameter list and move to it.\n\nThis is a utility function for\n`typescript--backward-to-parameter-list'.\n\nThis function must be called with the point placed on the final >\nof the generic's parameter list.  It will scan backwards to find\nthe start.  If successful, it will move the point to the start of\nthe list.  If not, it does not move the point.\n\nReturns nil on failure, or the position to which the point was\nmoved on success.\"\n  (when (eq (char-after) ?>)\n    (let ((depth 1))\n      (cl-loop named search-loop\n            while (> depth 0)\n            do (progn\n                 (unless (re-search-backward \"[<>]\" nil t)\n                   (cl-return-from search-loop nil))\n                 (cond\n                  ((looking-at \">\")\n                   (unless (eq (char-before) ?=)\n                     (setq depth (1+ depth))))\n                  ((looking-at \"<\") (setq depth (1- depth)))))\n            finally return (point)))))\n\n(defun typescript--backward-to-parameter-list ()\n  \"Search backward for the end of a parameter list and move to it.\n\nThis is a utility function for `typescript--proper-indentation'.\n\nThis function must be called with the point placed before an\nopening curly brace.  It will try to skip over the type\nannotation that would mark the return value of a function and\nmove to the end of the parameter list.  If it is unsuccessful, it\ndoes not move the point. \\\"Unsuccessful\\\" here also means that\nthe position at which we started did not in fact mark the\nbeginning of a function. The curly brace belonged to some other\nsyntactic construct than a function.\n\nReturns nil on failure, or the position to which the point was\nmoved on success.\"\n  (let ((location\n         (or\n          ;; This handles the case of a function with return type annotation.\n          (save-excursion\n            (cl-loop named search-loop\n                  do\n                  (typescript--backward-syntactic-ws)\n                  ;; Check whether we are at \"):\".\n                  (when (and (eq (char-before) ?\\:)\n                             (progn\n                               (backward-char)\n                               (skip-syntax-backward \" \")\n                               (eq (char-before) ?\\))))\n                    ;; Success! This the end of the parameter list.\n                    (cl-return-from search-loop (point)))\n                  ;; If we recognize a structure that belongs in a return type annotation,\n                  ;; skip back over it, or fail.\n                  (cond\n                   ;; Arrow of a function definition, or typeguard (eg. foo is SomeClass)\n                   ((looking-back \"=>\\\\|is\" (- (point) 2))\n                    (backward-char 2))\n                   ;; End of the parameters list of a generic.\n                   ((eq (char-before) ?>)\n                    (backward-char)\n                    (typescript--backward-over-generic-parameter-list))\n                   ;; Union of types, or a dot in a dotted name.\n                   ((memq (char-before) '(?| ?.))\n                    (backward-char))\n                   ((or\n                     ;; End-delimiter of a delimited construct, for constructs\n                     ;; not handled above.\n                     (memq (char-before) '(?\\) ?} ?\\\" ?\\]))\n                     ;; This is also dealing with dotted names. This may come\n                     ;; into play if a jump back moves over an entire dotted\n                     ;; name at once.\n                     ;;\n                     ;; The earlier test for dotted names comes into play if the\n                     ;; logic moves over one part of a dotted name at a time (which\n                     ;; is what `backward-sexp` normally does).\n                     (and (looking-back typescript--dotted-name-re nil)\n                          ;; We don't want the loop to walk over constructs like switch (...) or for (...), etc.\n                          (not (save-excursion\n                                 (backward-word)\n                                 (looking-at \"\\\\_<\\\\(switch\\\\|if\\\\|while\\\\|until\\\\|for\\\\)\\\\_>\\\\(?:\\\\s-\\\\|\\n\\\\)*(\")))))\n                    (condition-case nil\n                        (backward-sexp)\n                      (scan-error (cl-return-from search-loop nil))))\n                   ((looking-back typescript--number-literal-re\n                                  ;; We limit the search back to the previous space or end of line (if possible)\n                                  ;; to prevent the search from going over the whole buffer.\n                                  (save-excursion (re-search-backward \"\\\\(?:\\\\s-\\\\|\\n\\\\)\" nil t)) t)\n                    (goto-char (match-beginning 0)))\n                   ;; Otherwise, we failed to find a location.\n                   (t\n                    (cl-return-from search-loop nil)))))\n          ;; This handles the case of a function without return type annotation.\n          (progn\n            (typescript--backward-syntactic-ws)\n            (when (eq (char-before) ?\\))\n              (point))))))\n    (when location\n      (goto-char location))))\n\n(defun typescript--proper-indentation (parse-status)\n  \"Return the proper indentation for the current line.\"\n  (save-excursion\n    (back-to-indentation)\n    (let ((member-expr-p (looking-at \"\\\\.\")))\n      (cond ((nth 4 parse-status) ;; Inside a comment.\n             (typescript--get-c-offset 'c (nth 8 parse-status)))\n            ((nth 8 parse-status) 0) ;; Inside a string.\n            ((typescript--ctrl-statement-indentation)) ;; Control statements.\n            ((eq (char-after) ?#) 0) ;; Looking at a pragma.\n            ;; Inside a list of things. Note that in the TS contents, the curly braces\n            ;; marking code blocks are \"list of things\".\n            ((nth 1 parse-status)\n             (let ((indent-start (point))\n                   (same-indent-p (looking-at \"[]})]\"))\n                   (switch-keyword-p (looking-at \"\\\\_<default\\\\_>\\\\|\\\\_<case\\\\_>[^:]\"))\n                   (continued-expr-p (typescript--continued-expression-p))\n                   (list-start (nth 1 parse-status)))\n               (goto-char list-start)\n               (if (looking-at \"[({[]\\\\s-*\\\\(/[/*]\\\\|$\\\\)\")\n                   (progn\n                     (skip-syntax-backward \" \")\n                     (cond\n                      ((or (typescript--backward-to-parameter-list)\n                           (eq (char-before) ?\\)))\n                       ;; Take the curly brace as marking off the body of a function.\n                       ;; In that case, we want the code that follows to see the indentation\n                       ;; that was in effect at the beginning of the function declaration, and thus\n                       ;; we want to move back over the list of function parameters.\n                       (condition-case nil\n                           (backward-list)\n                         (error nil)))\n                      ((looking-back \",\" nil)\n                       ;; If we get here, we have a comma, spaces and an opening curly brace. (And\n                       ;; (point) is just after the comma.) We don't want to move from the current position\n                       ;; so that object literals in parameter lists are properly indented.\n                       nil)\n                      (t\n                       ;; In all other cases, we don't want to move from the curly brace.\n                       (goto-char list-start)))\n                     (back-to-indentation)\n                     (let* ((in-switch-p (unless same-indent-p\n                                           (looking-at \"\\\\_<switch\\\\_>\")))\n                            (same-indent-p (or same-indent-p\n                                               (and switch-keyword-p\n                                                    in-switch-p)))\n                            (indent\n                             (cond (same-indent-p\n                                    (current-column))\n                                   (continued-expr-p\n                                    (if (not member-expr-p)\n                                        (+ (current-column) (* 2 typescript-indent-level)\n                                           typescript-expr-indent-offset)\n                                      (goto-char indent-start)\n                                      (typescript--compute-member-expression-indent)))\n                                   (t\n                                    (+ (current-column) typescript-indent-level)))))\n                       (if (and in-switch-p typescript-indent-switch-clauses)\n                           (+ indent typescript-indent-level)\n                         indent)))\n                 (when (and (not same-indent-p)\n                            typescript-indent-list-items)\n                   (forward-char)\n                   (skip-chars-forward \" \\t\"))\n                 (if continued-expr-p\n                     (if (not member-expr-p)\n                         (progn (back-to-indentation)\n                                (+ (current-column) typescript-indent-level\n                                   typescript-expr-indent-offset))\n                       (goto-char indent-start)\n                       (typescript--compute-member-expression-indent))\n                   (current-column)))))\n\n            ((typescript--continued-expression-p) ;; Inside a continued expression.\n             (if member-expr-p\n                 (typescript--compute-member-expression-indent)\n               (+ typescript-indent-level typescript-expr-indent-offset)))\n            (t 0)))))\n\n(defun typescript-indent-line ()\n  \"Indent the current line as typescript.\"\n  (interactive)\n  (save-restriction\n    (widen)\n    (let* ((parse-status\n            (save-excursion (syntax-ppss (point-at-bol))))\n           (offset (- (current-column) (current-indentation))))\n      (indent-line-to (typescript--proper-indentation parse-status))\n      (when (> offset 0) (move-to-column (+ offset (current-indentation)))))))\n\n;;; Filling\n\n(defun typescript-c-fill-paragraph (&optional justify)\n  \"Fill the paragraph with `c-fill-paragraph'.\"\n  (interactive \"*P\")\n  ;; Dynamically replace functions using the lexically scoped cl-letf.\n  ;; See below for more details:\n  ;; http://endlessparentheses.com/understanding-letf-and-how-it-replaces-flet.html\n  (cl-letf (((symbol-function 'c-forward-sws)\n             (lambda  (&optional limit)\n               (typescript--forward-syntactic-ws limit)))\n            ((symbol-function 'c-backward-sws)\n             (lambda  (&optional limit)\n               (typescript--backward-syntactic-ws limit))))\n    (let ((fill-paragraph-function 'c-fill-paragraph))\n      (c-fill-paragraph justify))))\n\n;; We maintain a cache of semantic information, i.e., the classes and\n;; functions we've encountered so far. In order to avoid having to\n;; re-parse the buffer on every change, we cache the parse state at\n;; each interesting point in the buffer. Each parse state is a\n;; modified copy of the previous one, or in the case of the first\n;; parse state, the empty state.\n;;\n;; The parse state itself is just a stack of typescript--pitem\n;; instances. It starts off containing one element that is never\n;; closed, that is initially typescript--initial-pitem.\n;;\n\n\n(defun typescript--pitem-format (pitem)\n  (let ((name (typescript--pitem-name pitem))\n        (type (typescript--pitem-type pitem)))\n\n    (format \"name:%S type:%S\"\n            name\n            (if (atom type)\n                type\n              (plist-get type :name)))))\n\n(defun typescript--make-merged-item (item child name-parts)\n  \"Helper function for `typescript--splice-into-items'.\nReturn a new item that is the result of merging CHILD into\nITEM.  NAME-PARTS is a list of parts of the name of CHILD\nthat we haven't consumed yet.\"\n  (typescript--debug \"typescript--make-merged-item: {%s} into {%s}\"\n                   (typescript--pitem-format child)\n                   (typescript--pitem-format item))\n\n  ;; If the item we're merging into isn't a class, make it into one\n  (unless (consp (typescript--pitem-type item))\n    (typescript--debug \"typescript--make-merged-item: changing dest into class\")\n    (setq item (make-typescript--pitem\n                :children (list item)\n\n                ;; Use the child's class-style if it's available\n                :type (if (atom (typescript--pitem-type child))\n                          typescript--dummy-class-style\n                  (typescript--pitem-type child))\n\n                :name (typescript--pitem-strname item))))\n\n  ;; Now we can merge either a function or a class into a class\n  (cons (cond\n         ((cdr name-parts)\n          (typescript--debug \"typescript--make-merged-item: recursing\")\n          ;; if we have more name-parts to go before we get to the\n          ;; bottom of the class hierarchy, call the merger\n          ;; recursively\n          (typescript--splice-into-items (car item) child\n                                       (cdr name-parts)))\n\n         ((atom (typescript--pitem-type child))\n          (typescript--debug \"typescript--make-merged-item: straight merge\")\n          ;; Not merging a class, but something else, so just prepend\n          ;; it\n          (cons child (car item)))\n\n         (t\n          ;; Otherwise, merge the new child's items into those\n          ;; of the new class\n          (typescript--debug \"typescript--make-merged-item: merging class contents\")\n          (append (car child) (car item))))\n        (cdr item)))\n\n(defun typescript--pitem-strname (pitem)\n  \"Last part of the name of PITEM, as a string or symbol.\"\n  (let ((name (typescript--pitem-name pitem)))\n    (if (consp name)\n        (car (last name))\n      name)))\n\n(defun typescript--splice-into-items (items child name-parts)\n  \"Splice CHILD into the `typescript--pitem' ITEMS at NAME-PARTS.\nIf a class doesn't exist in the tree, create it.  Return\nthe new items list.  NAME-PARTS is a list of strings given\nthe broken-down class name of the item to insert.\"\n\n  (let ((top-name (car name-parts))\n        (item-ptr items)\n        new-items last-new-item new-cons item)\n\n    (typescript--debug \"typescript--splice-into-items: name-parts: %S items:%S\"\n             name-parts\n             (mapcar #'typescript--pitem-name items))\n\n    (cl-assert (stringp top-name))\n    (cl-assert (> (length top-name) 0))\n\n    ;; If top-name isn't found in items, then we build a copy of items\n    ;; and throw it away. But that's okay, since most of the time, we\n    ;; *will* find an instance.\n\n    (while (and item-ptr\n                (cond ((equal (typescript--pitem-strname (car item-ptr)) top-name)\n                       ;; Okay, we found an entry with the right name. Splice\n                       ;; the merged item into the list...\n                       (setq new-cons (cons (typescript--make-merged-item\n                                             (car item-ptr) child\n                                             name-parts)\n                                            (cdr item-ptr)))\n\n                       (if last-new-item\n                           (setcdr last-new-item new-cons)\n                         (setq new-items new-cons))\n\n                       ;; ...and terminate the loop\n                       nil)\n\n                      (t\n                       ;; Otherwise, copy the current cons and move onto the\n                       ;; text. This is tricky; we keep track of the tail of\n                       ;; the list that begins with new-items in\n                       ;; last-new-item.\n                       (setq new-cons (cons (car item-ptr) nil))\n                       (if last-new-item\n                           (setcdr last-new-item new-cons)\n                         (setq new-items new-cons))\n                       (setq last-new-item new-cons)\n\n                       ;; Go to the next cell in items\n                       (setq item-ptr (cdr item-ptr))))))\n\n    (if item-ptr\n        ;; Yay! We stopped because we found something, not because\n        ;; we ran out of items to search. Just return the new\n        ;; list.\n        (progn\n          (typescript--debug \"search succeeded: %S\" name-parts)\n          new-items)\n\n      ;; We didn't find anything. If the child is a class and we don't\n      ;; have any classes to drill down into, just push that class;\n      ;; otherwise, make a fake class and carry on.\n      (typescript--debug \"search failed: %S\" name-parts)\n      (cons (if (cdr name-parts)\n                ;; We have name-parts left to process. Make a fake\n                ;; class for this particular part...\n                (make-typescript--pitem\n                 ;; ...and recursively digest the rest of the name\n                 :children (typescript--splice-into-items\n                            nil child (cdr name-parts))\n                 :type typescript--dummy-class-style\n                 :name top-name)\n\n              ;; Otherwise, this is the only name we have, so stick\n              ;; the item on the front of the list\n              child)\n            items))))\n\n(defun typescript--pitem-add-child (pitem child)\n  \"Copy `typescript--pitem' PITEM, and push CHILD onto its list of children.\"\n  (cl-assert (integerp (typescript--pitem-h-begin child)))\n  (cl-assert (if (consp (typescript--pitem-name child))\n              (cl-loop for part in (typescript--pitem-name child)\n                    always (stringp part))\n            t))\n\n  ;; This trick works because we know (based on our cl-defstructs) that\n  ;; the child list is always the first element, and so the second\n  ;; element and beyond can be shared when we make our \"copy\".\n  (cons\n\n   (let ((name (typescript--pitem-name child))\n         (type (typescript--pitem-type child)))\n\n     (cond ((cdr-safe name) ; true if a list of at least two elements\n            ;; Use slow path because we need class lookup\n            (typescript--splice-into-items (car pitem) child name))\n\n           ((and (consp type)\n                 (plist-get type :prototype))\n\n            ;; Use slow path because we need class merging. We know\n            ;; name is a list here because down in\n            ;; `typescript--ensure-cache', we made sure to only add\n            ;; class entries with lists for :name\n            (cl-assert (consp name))\n            (typescript--splice-into-items (car pitem) child name))\n\n           (t\n            ;; Fast path\n            (cons child (car pitem)))))\n\n   (cdr pitem)))\n\n;;; compilation-mode support\n\n;; tsc supports formatting errors in two general ways: plain and\n;; pretty. (\"Plain\" is our term for \"not pretty\".) In tsc versions\n;; prior to 2.7, the plain and pretty formats both used the same\n;; format for references into files. `typescript-tsc-error-regexp`\n;; covers both plain and pretty for those versions.\n;;\n;; Version 2.7 changed the pretty format so as to format source code\n;; references differently. This required the introduction of\n;; `typescript-tsc-pretty-error-regexp`. The format of plain error\n;; messages did not change. So from that version onwards,\n;; `typescript-tsc-error-regexp` covers plain error messages and\n;; `typescript-tsc-pretty-error-regexp` covers pretty error messages.\n\n;; handle plain compiler-errors like the following when doing M-x compile<ret>tsc<ret>\n;;\n;; greeter.ts(24,9): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.\n;; greeter.ts(30,12): error TS2339: Property 'indexOf' does not exist on type 'number'.\n(defconst typescript-tsc-error-regexp\n  (concat\n   \"^[[:blank:]]*\"\n   \"\\\\([^(\\r\\n)]+\\\\)(\\\\([0-9]+\\\\),\\\\([0-9]+\\\\)):[[:blank:]]+\"\n   \"error [[:alnum:]]+: [^\\r\\n]+$\")\n  \"Regexp to match errors generated by tsc.\")\n\n;; handle pretty compiler-errors like the following when doing M-x compile<ret>tsc<ret>\n;; test.ts:2:7 - error TS2322: Type '2' is not assignable to type 'string'.\n(defconst typescript-tsc-pretty-error-regexp\n  (concat\n   \"^[[:blank:]]*\"\n   \"\\\\([^(\\r\\n)]+\\\\):\\\\([0-9]+\\\\):\\\\([0-9]+\\\\) - [[:blank:]]*\"\n   \"error [[:alnum:]]+: [^\\r\\n]+$\")\n  \"Regexp to match errors generated by tsc.\")\n\n;;\n;; Should handle output like:\n;; src/modules/authenticator.ts[1, 83]: ' should be \"\n;; (quotemarks) src/modules/authenticator.ts[2, 26]: ' should be \"\n;; ERROR: (quotemarks) src/modules/authenticator.ts[2, 26]: ' should be \"\n;; WARNING: src/modules/authenticator.ts[2, 26]: ' should be \"\n;;\n;; \"(quotemarks)\" it the rule name. It is produced when using the\n;; \"verbose\" formatter. The \"verbose\" formatter is identical to the\n;; default (\"prose\") formatter, except for the additional rule name.\n;;\n;; \"ERROR:\" and \"WARNING:\" are the severity. This was added in tslint\n;; 5.0. Prior versions have no notion of severity and simply omit this\n;; part.\n;;\n(defconst typescript-tslint-report-regexp\n  (concat\n   \"^[[:blank:]]*\"\n   ;; severity (\"type\" in Emacs' parlance)\n   \"\\\\(?:\\\\(?:ERROR\\\\|\\\\(WARNING\\\\)\\\\):[[:blank:]]+\\\\)?\"\n   ;; rule name\n   \"\\\\((.*)[[:blank:]]+\\\\)?\"\n   ;; filename\n   \"\\\\([^(\\r\\n)]+\\\\)\"\n   \"\\\\[\"\n   ;; line\n   \"\\\\([[:digit:]]+\\\\)\"\n   \", \"\n   ;; column\n   \"\\\\([[:digit:]]+\\\\)\"\n   \"\\\\]: \"\n   ;; message\n   \".*$\")\n  \"Regexp to match reports generated by tslint.\")\n\n(defconst typescript-nglint-error-regexp\n  (concat\n   ;; severity (\"type\" in Emacs' parlance)\n   \"ERROR:[[:blank:]]+\"\n\n   ;; filename\n   \"\\\\([^(\\r\\n)]+\\\\)\"\n   \":\"\n   ;; line\n   \"\\\\([[:digit:]]+\\\\)\"\n   \":\"\n   ;; column\n   \"\\\\([[:digit:]]+\\\\)\"\n\n   \" - \"\n   ;; message\n   \".*$\"))\n\n(defconst typescript-nglint-warning-regexp\n  (concat\n   ;; severity (\"type\" in Emacs' parlance)\n   \"WARNING:[[:blank:]]+\"\n\n   ;; filename\n   \"\\\\([^(\\r\\n)]+\\\\)\"\n   \":\"\n   ;; line\n   \"\\\\([[:digit:]]+\\\\)\"\n   \":\"\n   ;; column\n   \"\\\\([[:digit:]]+\\\\)\"\n\n   \" - \"\n   ;; message\n   \".*$\"))\n\n(dolist\n    (regexp\n     `((typescript-tsc\n        ,typescript-tsc-error-regexp\n        1 2 3 2)\n\n       (typescript-tsc-pretty\n        ,typescript-tsc-pretty-error-regexp\n        1 2 3 2)\n\n       (typescript-tslint\n        ,typescript-tslint-report-regexp\n        3 4 5 (1))\n\n       (typescript-nglint-error\n        ,typescript-nglint-error-regexp\n        1 2 3 2)\n\n       (typescript-nglint-warning\n        ,typescript-nglint-warning-regexp\n        1 2 3 1)))\n  (add-to-list 'compilation-error-regexp-alist-alist regexp)\n  (add-to-list 'compilation-error-regexp-alist (car regexp)))\n\n;;; Main Function\n\n;;;###autoload\n(define-derived-mode typescript-mode prog-mode \"TypeScript\"\n  \"Major mode for editing typescript.\n\nKey bindings:\n\n\\\\{typescript-mode-map}\"\n\n  :group 'typescript\n  :syntax-table typescript-mode-syntax-table\n\n  (setq-local indent-line-function 'typescript-indent-line)\n  (setq-local beginning-of-defun-function 'typescript-beginning-of-defun)\n  (setq-local end-of-defun-function 'typescript-end-of-defun)\n  (setq-local open-paren-in-column-0-is-defun-start nil)\n  (setq-local font-lock-defaults (list typescript--font-lock-keywords))\n  (setq-local font-lock-multiline t)\n  (setq-local syntax-propertize-function #'typescript-syntax-propertize)\n  (setq-local parse-sexp-ignore-comments t)\n  (setq-local parse-sexp-lookup-properties t)\n\n  ;; Comments\n  (setq-local comment-start \"// \")\n  (setq-local comment-end \"\")\n  (setq-local fill-paragraph-function 'typescript-c-fill-paragraph)\n\n  ;; Parse cache\n  (add-hook 'before-change-functions #'typescript--flush-caches t t)\n\n  ;; Frameworks\n  (typescript--update-quick-match-re)\n\n  ;; for filling, pretend we're cc-mode\n  (setq c-comment-prefix-regexp \"//+\\\\|\\\\**\"\n        c-paragraph-start \"$\"\n        c-paragraph-separate \"$\"\n        c-block-comment-prefix \"* \"\n        c-block-comment-ender-regexp \"\\\\*/\"\n        c-line-comment-starter \"//\"\n        c-comment-start-regexp \"/[*/]\\\\|\\\\s!\"\n        comment-start-skip \"\\\\(//+\\\\|/\\\\*+\\\\)\\\\s *\")\n\n  (setq-local electric-indent-chars\n          (append \"{}():;,\" electric-indent-chars))\n  (setq-local electric-layout-rules\n          '((?\\; . after) (?\\{ . after) (?\\} . before)))\n\n  (let ((c-buffer-is-cc-mode t))\n    ;; FIXME: These are normally set by `c-basic-common-init'.  Should\n    ;; we call it instead?  (Bug#6071)\n    (make-local-variable 'paragraph-start)\n    (make-local-variable 'paragraph-separate)\n    (make-local-variable 'paragraph-ignore-fill-prefix)\n    (make-local-variable 'adaptive-fill-mode)\n    (make-local-variable 'adaptive-fill-regexp)\n    (c-setup-paragraph-variables))\n\n  (add-hook 'post-self-insert-hook\n            #'typescript--post-self-insert-function)\n\n  (setq-local syntax-begin-function #'typescript--syntax-begin-function))\n\n;; Set our custom predicate for flyspell prog mode\n(put 'typescript-mode 'flyspell-mode-predicate\n     'typescript--flyspell-mode-predicate)\n\n;;;###autoload\n(eval-after-load 'folding\n  '(when (fboundp 'folding-add-to-marks-list)\n     (folding-add-to-marks-list 'typescript-mode \"// {{{\" \"// }}}\" )))\n\n;;;###autoload\n(add-to-list 'auto-mode-alist '(\"\\\\.tsx?\\\\'\" . typescript-mode))\n\n(provide 'typescript-mode)\n\n;;; typescript-mode.el ends here\n"
  }
]