Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-131257

Figure out how to provide type definitions for Liferay global object

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JS APIs and Utilities
    • Labels:
      None

      Description

      This is a left-over TODO from the recent work on TS, as described here:

      https://github.com/liferay/liferay-portal/commit/258113801997cd4333fa255e1ee207a999b6cfbe

      Just to make this "official", here's what I discussed with Bryce Osterhaus over Slack last night:

      the one that i actually think is most important, and i haven't created yet, is figuring out the best way to write and make available type declarations for the global Liferay object and its various sub-properties... in part it is hard because it is defined and sometimes conditionally defined in various places, augmented from various places (eg. IIRC, there's even some of it coming from print statements in Java classes... then JSP, and of course JS).

      But until we do it, we're going to have a big ugly hole in the type system with lots of nasty casts.

      ideally the solution will allow us to define the base/legacy bits in one central place, but for anything "modern", it would be nice to augment/extend the interface from the place where the augmentation actually happens (eg. @liferay/frontend-js-state-web adds Liferay.State — it makes sense for the type of Liferay.State to be defined there and not somewhere central)

      i briefly explored it while working on the API but ultimately deferred it because i figured it was going to be nasty

      here's an example of where I had to infest @liferay/frontend-js-react-web with some horrid any casts: https://github.com/liferay/liferay-portal/blob/4b4ff53717645e7bf4c4b373b5cb5d218fb1207a/modules/apps/frontend-js/frontend-js-react-web/src/main/resources/META-INF/resources/js/render.tsx

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bryce.osterhaus Bryce Osterhaus
              Reporter:
              greg.hurrell Greg Hurrell (Inactive)
              Recent user:
              Greg Hurrell (Inactive)
              Participants of an Issue:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Packages

                  Version Package