Skip to content

Commit

Permalink
Merge pull request #214 from github/add-jsx-intrinsicelement-types
Browse files Browse the repository at this point in the history
add JSX IntrinsicElement types
  • Loading branch information
keithamus authored Nov 28, 2022
2 parents 223bc5d + b66d687 commit f35461a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
"import/no-unresolved": "off"
},
"overrides": [
{
"files": "src/*-define.ts",
"rules": {
"@typescript-eslint/no-namespace": "off"
}
},
{
"files": "test/**/*.js",
"rules": {
Expand Down
8 changes: 8 additions & 0 deletions src/local-time-element-define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ try {
}
}

type JSXBaseElement = JSX.IntrinsicElements extends {span: unknown}
? JSX.IntrinsicElements['span']
: Record<string, unknown>
declare global {
interface Window {
LocalTimeElement: typeof LocalTimeElement
}
interface HTMLElementTagNameMap {
'local-time': LocalTimeElement
}
namespace JSX {
interface IntrinsicElements {
['local-time']: JSXBaseElement & Partial<Omit<LocalTimeElement, keyof HTMLElement>>
}
}
}

export default LocalTimeElement
Expand Down
8 changes: 8 additions & 0 deletions src/relative-time-element-define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ try {
}
}

type JSXBaseElement = JSX.IntrinsicElements extends {span: unknown}
? JSX.IntrinsicElements['span']
: Record<string, unknown>
declare global {
interface Window {
RelativeTimeElement: typeof RelativeTimeElement
}
interface HTMLElementTagNameMap {
'relative-time': RelativeTimeElement
}
namespace JSX {
interface IntrinsicElements {
['relative-time']: JSXBaseElement & Partial<Omit<RelativeTimeElement, keyof HTMLElement>>
}
}
}

export default RelativeTimeElement
Expand Down
8 changes: 8 additions & 0 deletions src/time-ago-element-define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ try {
}
}

type JSXBaseElement = JSX.IntrinsicElements extends {span: unknown}
? JSX.IntrinsicElements['span']
: Record<string, unknown>
declare global {
interface Window {
TimeAgoElement: typeof TimeAgoElement
}
interface HTMLElementTagNameMap {
'time-ago': TimeAgoElement
}
namespace JSX {
interface IntrinsicElements {
['time-ago']: JSXBaseElement & Partial<Omit<TimeAgoElement, keyof HTMLElement>>
}
}
}

export default TimeAgoElement
Expand Down
8 changes: 8 additions & 0 deletions src/time-until-element-define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,21 @@ try {
}
}

type JSXBaseElement = JSX.IntrinsicElements extends {span: unknown}
? JSX.IntrinsicElements['span']
: Record<string, unknown>
declare global {
interface Window {
TimeUntilElement: typeof TimeUntilElement
}
interface HTMLElementTagNameMap {
'time-until': TimeUntilElement
}
namespace JSX {
interface IntrinsicElements {
['time-until']: JSXBaseElement & Partial<Omit<TimeUntilElement, keyof HTMLElement>>
}
}
}

export default TimeUntilElement
Expand Down

0 comments on commit f35461a

Please sign in to comment.