ampproject / ampproject/amphtml

Create a typescript declaration file for the viewer

Open
#25,694 3 comments 0 reactions 0 assignees View on GitHub
Stale Type: Feature Request WG: amp4email
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

We need to create [d.ts](https://www.google.com/search?sxsrf=ACYBGNSxcJIiyZut5UzSKbkm0S8VHMZd3w%3A1574272996370&ei=5H_VXbabFqKd5wKgkZTYCw&q=declaration+file+typescript&oq=declaration+file+typescript&gs_l=psy-ab.3..0i7i30j0j0i8i7i30l4j0i30l2j0i5i30l2.17039.17039..17395...0.3..0.78.78.1......0....1..gws-wiz.......0i71.Y5u3CCOEcks&ved=0ahUKEwi2nen1r_nlAhWizlkKHaAIBbsQ4dUDCAs&uact=5) file for the [viewer-interface](https://github.com/ampproject/amphtml/blob/master/src/service/viewer-interface.js) for consumption for [amp-email-viewer](https://github.com/ampproject/amp-email-viewer). By doing this we can ensure that any changes to the viewer will propagate to the amp-email-viewer which currently duplicates values defined in viewer related code/service as opposed to importing it. This will be useful moving forward for users who have an interest in creating a custom viewer and understanding the interface.

Ideally, we should extract out all viewer related info and constants to a separate repo e.g. ampproject/viewer and push them to the amproject/amphtml and ampproject/amp-email-viewer?

Alternatively (via @fstanis ) use https://github.com/google/copybara to copy viewer related info to amp-email-viewer

Contributor guide

Open the contributing guide

Research direction

Start with src/service/viewer-interface.js and compare its viewer-related values with the duplicated code in amp-email-viewer. Define the TypeScript declaration for the viewer interface so amp-email-viewer and custom viewers can consume it; the issue also mentions evaluating a shared viewer repository or Copybara, so that scope needs clarification before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.