Last active
November 19, 2022 06:08
-
-
Save azu/2dec148bcec2ea8a34c894aee51b3571 to your computer and use it in GitHub Desktop.
TypeScript definitions for AMP Attributes. Write AMP in JSX.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // roughish AMP attribute types for JSX/TypeScript | |
| // Source: https://playground.amp.dev/amphtml-hint.json | |
| // https://github.com/Microsoft/TypeScript/issues/15449 | |
| // https://stackoverflow.com/questions/50585952/typescript-and-google-amp-property-amp-img-does-not-exist-on-type-jsx-intrin | |
| import * as React from 'react'; | |
| // why null ? | |
| type _ANY = any; | |
| type _ANYS = any; | |
| declare module 'react' { | |
| interface HTMLAttributes<T> { | |
| // Add | |
| autoscroll?: boolean; | |
| on?: _ANY | |
| // defin | |
| amp?: _ANYS; | |
| '⚡'?: _ANYS; | |
| '[text]'?: _ANY; | |
| 'xml:lang'?: _ANY; | |
| 'xml:space'?: _ANY; | |
| xmlns?: _ANY; | |
| 'xmlns:xlink'?: _ANY; | |
| style?: _ANY; | |
| href?: _ANYS | _ANY; | |
| target?: _ANYS | _ANY; | |
| rel?: _ANYS | _ANY; | |
| charset?: _ANYS; | |
| color?: _ANY; | |
| crossorigin?: _ANY; | |
| hreflang?: _ANY; | |
| media?: _ANY; | |
| sizes?: _ANY; | |
| type?: _ANY | _ANYS; | |
| as?: _ANY; | |
| async?: _ANY | _ANYS; | |
| integrity?: _ANY; | |
| itemprop?: _ANY; | |
| property?: _ANY; | |
| content?: _ANY; | |
| name?: _ANYS | _ANY; | |
| 'http-equiv'?: _ANYS; | |
| scheme?: _ANY; | |
| 'amp-custom'?: _ANYS; | |
| nonce?: _ANY; | |
| 'amp-boilerplate'?: _ANYS; | |
| 'amp-keyframes'?: _ANYS; | |
| expanded?: _ANYS; | |
| toolbar?: _ANY; | |
| 'toolbar-target'?: _ANY; | |
| align?: _ANY; | |
| cite?: _ANY; | |
| reversed?: _ANYS; | |
| start?: _ANY; | |
| value?: _ANY; | |
| 'verify-error'?: _ANY; | |
| template?: _ANY | _ANYS; | |
| submitting?: _ANY; | |
| 'submit-success'?: _ANY; | |
| 'submit-error'?: _ANY; | |
| first?: _ANY; | |
| second?: _ANY; | |
| border?: _ANY | _ANYS; | |
| download?: _ANY; | |
| referrerpolicy?: _ANY | _ANYS; | |
| role?: _ANY; | |
| tabindex?: _ANY; | |
| '[href]'?: _ANY; | |
| datetime?: _ANY; | |
| dir?: _ANY; | |
| src?: _ANY | _ANYS; | |
| '[src]'?: _ANY; | |
| '[type]'?: _ANY; | |
| poster?: _ANY; | |
| noloading?: _ANYS; | |
| album?: _ANY; | |
| alt?: _ANY; | |
| artist?: _ANY; | |
| artwork?: _ANY; | |
| attribution?: _ANY; | |
| autoplay?: _ANYS | _ANY; | |
| controls?: _ANYS | _ANY; | |
| controlslist?: _ANY; | |
| disableremoteplayback?: _ANYS; | |
| dock?: _ANY; | |
| loop?: _ANYS; | |
| muted?: _ANYS; | |
| noaudio?: _ANYS; | |
| placeholder?: _ANY; | |
| preload?: _ANYS; | |
| 'rotate-to-fullscreen'?: _ANYS; | |
| '[album]'?: _ANY; | |
| '[alt]'?: _ANY; | |
| '[artist]'?: _ANY; | |
| '[artwork]'?: _ANY; | |
| '[attribution]'?: _ANY; | |
| '[controls]'?: _ANY; | |
| '[controlslist]'?: _ANY; | |
| '[loop]'?: _ANY; | |
| '[poster]'?: _ANY; | |
| '[preload]'?: _ANY; | |
| '[title]'?: _ANY; | |
| lightbox?: _ANY; | |
| 'lightbox-thumbnail-id'?: _ANY; | |
| layout?: _ANYS; | |
| 'data-src'?: _ANY; | |
| 'data-tag'?: _ANY; | |
| '\'default\''?: _ANYS | _ANY; | |
| kind?: _ANYS; | |
| label?: _ANY; | |
| srclang?: _ANY; | |
| '[label]'?: _ANY; | |
| '[srclang]'?: _ANY; | |
| externalresourcesrequired?: _ANY; | |
| transform?: _ANY; | |
| requiredextensions?: _ANY; | |
| requiredfeatures?: _ANY; | |
| systemlanguage?: _ANY; | |
| 'alignment-baseline'?: _ANY; | |
| 'baseline-shift'?: _ANY; | |
| clip?: _ANY; | |
| 'clip-path'?: _ANY; | |
| 'clip-rule'?: _ANY; | |
| 'color-interpolation'?: _ANY; | |
| 'color-interpolation-filters'?: _ANY; | |
| 'color-profile'?: _ANY; | |
| 'color-rendering'?: _ANY; | |
| cursor?: _ANY; | |
| direction?: _ANY; | |
| display?: _ANY; | |
| 'dominant-baseline'?: _ANY; | |
| 'enable-background'?: _ANY; | |
| fill?: _ANY; | |
| 'fill-opacity'?: _ANY; | |
| 'fill-rule'?: _ANY; | |
| filter?: _ANY; | |
| 'flood-color'?: _ANY; | |
| 'flood-opacity'?: _ANY; | |
| 'font-family'?: _ANY; | |
| 'font-size'?: _ANY; | |
| 'font-size-adjust'?: _ANY; | |
| 'font-stretch'?: _ANY; | |
| 'font-style'?: _ANY; | |
| 'font-variant'?: _ANY; | |
| 'font-weight'?: _ANY; | |
| 'glyph-orientation-horizontal'?: _ANY; | |
| 'glyph-orientation-vertical'?: _ANY; | |
| 'image-rendering'?: _ANY; | |
| kerning?: _ANY; | |
| 'letter-spacing'?: _ANY; | |
| 'lighting-color'?: _ANY; | |
| 'marker-end'?: _ANY; | |
| 'marker-mid'?: _ANY; | |
| 'marker-start'?: _ANY; | |
| mask?: _ANY; | |
| opacity?: _ANY; | |
| overflow?: _ANY; | |
| 'pointer-events'?: _ANY; | |
| 'shape-rendering'?: _ANY; | |
| 'stop-color'?: _ANY; | |
| 'stop-opacity'?: _ANY; | |
| stroke?: _ANY; | |
| 'stroke-dasharray'?: _ANY; | |
| 'stroke-dashoffset'?: _ANY; | |
| 'stroke-linecap'?: _ANY; | |
| 'stroke-linejoin'?: _ANY; | |
| 'stroke-miterlimit'?: _ANY; | |
| 'stroke-opacity'?: _ANY; | |
| 'stroke-width'?: _ANY; | |
| 'text-anchor'?: _ANY; | |
| 'text-decoration'?: _ANY; | |
| 'text-rendering'?: _ANY; | |
| 'unicode-bidi'?: _ANY; | |
| 'vector-effect'?: _ANY; | |
| visibility?: _ANY | _ANYS; | |
| 'word-spacing'?: _ANY; | |
| 'writing-mode'?: _ANY; | |
| 'arabic-form'?: _ANY; | |
| d?: _ANY; | |
| 'glyph-name'?: _ANY; | |
| 'horiz-adv-x'?: _ANY; | |
| orientation?: _ANY; | |
| unicode?: _ANY; | |
| 'vert-adv-y'?: _ANY; | |
| 'vert-origin-x'?: _ANY; | |
| 'vert-origin-y'?: _ANY; | |
| dx?: _ANY; | |
| dy?: _ANY; | |
| format?: _ANY; | |
| glyphref?: _ANY; | |
| x?: _ANY; | |
| y?: _ANY; | |
| 'xlink:actuate'?: _ANY; | |
| 'xlink:arcrole'?: _ANY; | |
| 'xlink:href'?: _ANY; | |
| 'xlink:role'?: _ANY; | |
| 'xlink:show'?: _ANY; | |
| 'xlink:title'?: _ANY; | |
| 'xlink:type'?: _ANY; | |
| height?: _ANY; | |
| preserveaspectratio?: _ANY; | |
| width?: _ANY; | |
| markerheight?: _ANY; | |
| markerunits?: _ANY; | |
| markerwidth?: _ANY; | |
| orient?: _ANY; | |
| refx?: _ANY; | |
| refy?: _ANY; | |
| viewbox?: _ANY; | |
| pathlength?: _ANY; | |
| 'sketch:type'?: _ANY; | |
| 'solid-color'?: _ANY; | |
| 'solid-opacity'?: _ANY; | |
| contentscripttype?: _ANY; | |
| contentstyletype?: _ANY; | |
| version?: _ANYS; | |
| zoomandpan?: _ANY; | |
| viewtarget?: _ANY; | |
| cx?: _ANY; | |
| cy?: _ANY; | |
| r?: _ANY; | |
| rx?: _ANY; | |
| ry?: _ANY; | |
| x1?: _ANY; | |
| x2?: _ANY; | |
| y1?: _ANY; | |
| y2?: _ANY; | |
| points?: _ANY; | |
| lengthadjust?: _ANY; | |
| rotate?: _ANY; | |
| textlength?: _ANY; | |
| method?: _ANY | _ANYS; | |
| spacing?: _ANY; | |
| startoffset?: _ANY; | |
| clippathunits?: _ANY; | |
| filterres?: _ANY; | |
| filterunits?: _ANY; | |
| primitiveunits?: _ANY; | |
| g1?: _ANY; | |
| g2?: _ANY; | |
| k?: _ANY; | |
| u1?: _ANY; | |
| u2?: _ANY; | |
| gradienttransform?: _ANY; | |
| gradientunits?: _ANY; | |
| spreadmethod?: _ANY; | |
| maskcontentunits?: _ANY; | |
| maskunits?: _ANY; | |
| patterncontentunits?: _ANY; | |
| patterntransform?: _ANY; | |
| patternunits?: _ANY; | |
| fr?: _ANY; | |
| fx?: _ANY; | |
| fy?: _ANY; | |
| offset?: _ANY; | |
| 'in'?: _ANY; | |
| values?: _ANY; | |
| result?: _ANY; | |
| in2?: _ANY; | |
| k1?: _ANY; | |
| k2?: _ANY; | |
| k3?: _ANY; | |
| k4?: _ANY; | |
| operator?: _ANY; | |
| edgemode?: _ANY; | |
| stddeviation?: _ANY; | |
| bgcolor?: _ANY; | |
| cellpadding?: _ANY; | |
| cellspacing?: _ANY; | |
| sortable?: _ANY; | |
| span?: _ANY; | |
| valign?: _ANY; | |
| colspan?: _ANY; | |
| headers?: _ANY; | |
| rowspan?: _ANY; | |
| abbr?: _ANY; | |
| scope?: _ANY; | |
| sorted?: _ANY; | |
| accept?: _ANY; | |
| 'accept-charset'?: _ANY; | |
| action?: _ANY; | |
| 'action-xhr'?: _ANY; | |
| autocomplete?: _ANY; | |
| 'custom-validation-reporting'?: _ANYS; | |
| enctype?: _ANY | _ANYS; | |
| novalidate?: _ANY; | |
| 'verify-xhr'?: _ANY; | |
| 'for'?: _ANY; | |
| accesskey?: _ANY; | |
| autofocus?: _ANY; | |
| checked?: _ANY; | |
| disabled?: _ANY | _ANYS; | |
| inputmode?: _ANY; | |
| list?: _ANY; | |
| max?: _ANY; | |
| maxlength?: _ANY; | |
| min?: _ANY; | |
| minlength?: _ANY; | |
| multiple?: _ANY | _ANYS; | |
| pattern?: _ANY; | |
| readonly?: _ANY; | |
| required?: _ANY; | |
| selectiondirection?: _ANY; | |
| size?: _ANY; | |
| spellcheck?: _ANY; | |
| step?: _ANY; | |
| '[accept]'?: _ANY; | |
| '[accesskey]'?: _ANY; | |
| '[autocomplete]'?: _ANY; | |
| '[checked]'?: _ANY; | |
| '[disabled]'?: _ANY; | |
| '[height]'?: _ANY; | |
| '[inputmode]'?: _ANY; | |
| '[max]'?: _ANY; | |
| '[maxlength]'?: _ANY; | |
| '[min]'?: _ANY; | |
| '[minlength]'?: _ANY; | |
| '[multiple]'?: _ANY; | |
| '[pattern]'?: _ANY; | |
| '[placeholder]'?: _ANY; | |
| '[readonly]'?: _ANY; | |
| '[required]'?: _ANY; | |
| '[selectiondirection]'?: _ANY; | |
| '[size]'?: _ANY; | |
| '[spellcheck]'?: _ANY; | |
| '[step]'?: _ANY; | |
| '[value]'?: _ANY; | |
| '[width]'?: _ANY; | |
| 'open-button'?: _ANYS; | |
| '[autofocus]'?: _ANY; | |
| selected?: _ANY; | |
| '[selected]'?: _ANY; | |
| cols?: _ANY; | |
| rows?: _ANY; | |
| selectionend?: _ANY; | |
| selectionstart?: _ANY; | |
| wrap?: _ANY; | |
| '[cols]'?: _ANY; | |
| '[rows]'?: _ANY; | |
| '[selectionend]'?: _ANY; | |
| '[selectionstart]'?: _ANY; | |
| '[wrap]'?: _ANY; | |
| form?: _ANY; | |
| high?: _ANY; | |
| low?: _ANY; | |
| optimum?: _ANY; | |
| id?: _ANYS | _ANY; | |
| '[srcset]'?: _ANY; | |
| srcset?: _ANY; | |
| 'allow-ssr-img'?: _ANY; | |
| alpha?: _ANYS; | |
| antialiasing?: _ANYS; | |
| autorotate?: _ANYS; | |
| clearcolor?: _ANY; | |
| enablezoom?: _ANYS; | |
| maxpixelratio?: _ANY; | |
| 'data-id'?: _ANY; | |
| animate?: _ANYS; | |
| 'disable-session-states'?: _ANYS; | |
| 'expand-single-section'?: _ANYS; | |
| json?: _ANY; | |
| 'rtc-config'?: _ANY; | |
| 'data-multi-size'?: _ANYS; | |
| 'data-enable-refresh'?: _ANYS; | |
| 'data-pub-id'?: _ANY; | |
| 'data-share-media'?: _ANY; | |
| 'data-share-url'?: _ANY; | |
| 'data-widget-id'?: _ANY; | |
| config?: _ANY; | |
| trigger?: _ANYS; | |
| 'data-apester-channel-token'?: _ANY; | |
| 'data-apester-media-id'?: _ANY; | |
| 'data-account'?: _ANY; | |
| 'data-content'?: _ANY; | |
| 'data-my-content'?: _ANYS; | |
| 'data-name'?: _ANY; | |
| credentials?: _ANY | _ANYS; | |
| overridable?: _ANY; | |
| arguments?: _ANY; | |
| expression?: _ANY; | |
| noautoplay?: _ANYS; | |
| renderer?: _ANYS; | |
| 'data-outstream'?: _ANY; | |
| 'data-partner'?: _ANY; | |
| 'data-player'?: _ANY; | |
| 'data-playlist'?: _ANY; | |
| 'data-video'?: _ANY; | |
| '[data-account]'?: _ANY; | |
| '[data-embed]'?: _ANY; | |
| '[data-player-id]'?: _ANY; | |
| '[data-player]'?: _ANY; | |
| '[data-playlist-id]'?: _ANY; | |
| '[data-video-id]'?: _ANY; | |
| '[data-referrer]'?: _ANY; | |
| 'data-label'?: _ANY; | |
| 'data-webcare-id'?: _ANY; | |
| arrows?: _ANYS; | |
| delay?: _ANY; | |
| dots?: _ANYS; | |
| '[slide]'?: _ANY; | |
| 'data-endscreen-enable'?: _ANYS; | |
| 'data-info'?: _ANYS; | |
| 'data-mute'?: _ANYS; | |
| 'data-sharing-enable'?: _ANYS; | |
| 'data-start'?: _ANY; | |
| 'data-ui-highlight'?: _ANY; | |
| 'data-ui-logo'?: _ANYS; | |
| 'data-videoid'?: _ANY; | |
| 'biggest-unit'?: _ANYS; | |
| 'end-date'?: _ANY; | |
| locale?: _ANYS | _ANY; | |
| 'offset-seconds'?: _ANY; | |
| 'timeleft-ms'?: _ANY; | |
| 'timestamp-ms'?: _ANY; | |
| 'timestamp-seconds'?: _ANY; | |
| 'when-ended'?: _ANYS; | |
| mode?: _ANYS; | |
| 'allow-blocked-ranges'?: _ANYS; | |
| blocked?: _ANY; | |
| 'day-size'?: _ANY; | |
| 'first-day-of-week'?: _ANY; | |
| highlighted?: _ANY; | |
| 'month-format'?: _ANY; | |
| 'number-of-months'?: _ANY; | |
| 'open-after-clear'?: _ANYS; | |
| 'open-after-select'?: _ANYS; | |
| 'week-day-format'?: _ANY; | |
| date?: _ANY; | |
| 'input-selector'?: _ANY; | |
| fullscreen?: _ANYS; | |
| 'touch-keyboard-editable'?: _ANYS; | |
| 'end-input-selector'?: _ANY; | |
| 'minimum-nights'?: _ANY; | |
| 'start-date'?: _ANY; | |
| 'start-input-selector'?: _ANY; | |
| 'date-template'?: _ANYS; | |
| dates?: _ANY; | |
| 'info-template'?: _ANY; | |
| 'data-url'?: _ANY; | |
| 'data-href'?: _ANY; | |
| 'max-font-size'?: _ANY; | |
| 'min-font-size'?: _ANY; | |
| 'on-error-add-class'?: _ANY; | |
| 'on-error-remove-class'?: _ANY; | |
| 'on-load-add-class'?: _ANY; | |
| 'on-load-remove-class'?: _ANY; | |
| timeout?: _ANY; | |
| 'data-gfyid'?: _ANY; | |
| 'data-gistid'?: _ANY; | |
| 'data-eid'?: _ANY; | |
| allow?: _ANY; | |
| allowfullscreen?: _ANYS; | |
| allowpaymentrequest?: _ANYS; | |
| allowtransparency?: _ANYS; | |
| frameborder?: _ANYS; | |
| resizable?: _ANYS; | |
| sandbox?: _ANY; | |
| scrolling?: _ANYS; | |
| srcdoc?: _ANY; | |
| 'disable-hint-reappear'?: _ANY; | |
| 'initial-slider-position'?: _ANY; | |
| 'step-size'?: _ANY; | |
| 'data-imgur-id'?: _ANY; | |
| 'data-shortcode'?: _ANY; | |
| 'data-iframe-src'?: _ANY; | |
| 'data-media-id'?: _ANY; | |
| 'data-player-id'?: _ANY; | |
| 'data-playlist-id'?: _ANY; | |
| 'animate-in'?: _ANYS; | |
| from?: _ANY; | |
| scrollable?: _ANY; | |
| '[open]'?: _ANY; | |
| 'auto-resize'?: _ANYS; | |
| binding?: _ANYS; | |
| items?: _ANY; | |
| 'max-items'?: _ANY; | |
| 'reset-on-refresh'?: _ANYS; | |
| 'single-item'?: _ANY; | |
| '[state]'?: _ANY; | |
| 'data-max-items-per-page'?: _ANY; | |
| 'data-poll-interval'?: _ANY; | |
| sort?: _ANYS; | |
| 'data-formula'?: _ANY; | |
| inline?: _ANY; | |
| 'data-mediaid'?: _ANY; | |
| 'data-client'?: _ANY; | |
| 'data-mode'?: _ANYS; | |
| 'data-origin'?: _ANY; | |
| 'data-streamtype'?: _ANYS; | |
| 'data-bcid'?: _ANY; | |
| 'data-pid'?: _ANY; | |
| 'data-embedcode'?: _ANY; | |
| 'data-pcode'?: _ANY; | |
| 'data-playerid'?: _ANY; | |
| 'alpha-range'?: _ANY; | |
| 'beta-range'?: _ANY; | |
| 'gamma-range'?: _ANY; | |
| 'disable-double-tap'?: _ANYS; | |
| 'initial-scale'?: _ANY; | |
| 'initial-x'?: _ANY; | |
| 'initial-y'?: _ANY; | |
| 'max-scale'?: _ANY; | |
| 'reset-on-resize'?: _ANYS; | |
| 'data-do'?: _ANY; | |
| 'data-comments'?: _ANYS; | |
| 'data-item'?: _ANY; | |
| 'data-item-info'?: _ANYS; | |
| 'data-share-buttons'?: _ANYS; | |
| 'intersection-ratios'?: _ANY; | |
| once?: _ANYS; | |
| 'viewport-margins'?: _ANY; | |
| 'data-embed-id'?: _ANY; | |
| 'data-embedlive'?: _ANYS; | |
| 'data-embedparent'?: _ANYS; | |
| '\'data-embedtype\''?: _ANYS | _ANY; | |
| 'data-riddle-id'?: _ANY; | |
| 'keyboard-select-mode'?: _ANYS; | |
| side?: _ANYS; | |
| 'data-share-endpoint'?: _ANY; | |
| 'data-color'?: _ANY; | |
| 'data-playlistid'?: _ANY; | |
| 'data-secret-token'?: _ANY; | |
| 'data-trackid'?: _ANY; | |
| 'data-visual'?: _ANYS; | |
| 'data-content-id'?: _ANY; | |
| 'data-domain'?: _ANY; | |
| 'data-items'?: _ANY; | |
| 'data-site-id'?: _ANY; | |
| 'background-audio'?: _ANY; | |
| 'bookend-config-src'?: _ANY; | |
| 'poster-landscape-src'?: _ANY; | |
| 'poster-portrait-src'?: _ANY; | |
| 'poster-square-src'?: _ANY; | |
| publisher?: _ANY; | |
| 'publisher-logo-src'?: _ANY; | |
| standalone?: _ANYS; | |
| title?: _ANY; | |
| 'auto-advance-after'?: _ANY; | |
| cutoff?: _ANY; | |
| '[datetime]'?: _ANY; | |
| 'data-cards'?: _ANY; | |
| 'data-conversation'?: _ANY; | |
| 'data-limit'?: _ANY; | |
| 'data-link-color'?: _ANY; | |
| 'data-momentid'?: _ANY; | |
| 'data-theme'?: _ANY; | |
| 'data-timeline-id'?: _ANY; | |
| 'data-timeline-owner-screen-name'?: _ANY; | |
| 'data-timeline-slug'?: _ANY; | |
| 'data-timeline-source-type'?: _ANY; | |
| 'data-timeline-screen-name'?: _ANY; | |
| 'data-timeline-url'?: _ANY; | |
| 'data-timeline-user-id'?: _ANY; | |
| 'data-tweetid'?: _ANY; | |
| 'data-dismiss-href'?: _ANY; | |
| 'data-show-if-href'?: _ANY; | |
| 'data-vineid'?: _ANY; | |
| 'data-profileid'?: _ANY; | |
| 'helper-iframe-url'?: _ANY; | |
| 'permission-dialog-url'?: _ANY; | |
| 'service-worker-url'?: _ANY; | |
| 'data-media-hashed-id'?: _ANY; | |
| 'data-app-key'?: _ANY; | |
| 'data-widget-type'?: _ANY; | |
| 'data-live-channelid'?: _ANY; | |
| '[data-videoid]'?: _ANY; | |
| amp4ads?: _ANYS; | |
| '⚡4ads'?: _ANYS; | |
| 'amp4ads-boilerplate'?: _ANYS; | |
| 'default'?: _ANYS; | |
| 'timeline-event-prefix'?: _ANY; | |
| 'close-button'?: _ANY; | |
| amp4email?: _ANYS; | |
| '⚡4email'?: _ANYS; | |
| 'amp4email-boilerplate'?: _ANYS; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, struggled with this for hours, I still don't get why does it work with
moduleand not withnamespacebut ok,My, simpler workaround: