Skip to content

Add TypeScript for extending JSX types with custom elements#2581

Merged
marvinhagemeister merged 5 commits intomasterfrom
custom-elements-ts
Jun 14, 2020
Merged

Add TypeScript for extending JSX types with custom elements#2581
marvinhagemeister merged 5 commits intomasterfrom
custom-elements-ts

Conversation

@andrewiggins
Copy link
Copy Markdown
Member

Add a new custom element TypeScript test that validates it is possible to extend Preact's JSX types with custom elements.

This PR also locks our TypeScript to 3.5.3. I've done this to ensure that future updates we make to our types are backwards compatible with our current min TS version. If we want to take advantage of a bugfix or feature in a future version of TS, we should bump this to the new min version of TypeScript and mention the new min version in the release notes for the next Preact release.

Resolves #1180

@github-actions
Copy link
Copy Markdown

Size Change: 0 B

Total Size: 39.7 kB

ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.2 kB 0 B
compat/dist/compat.module.js 3.23 kB 0 B
compat/dist/compat.umd.js 3.25 kB 0 B
debug/dist/debug.js 2.99 kB 0 B
debug/dist/debug.module.js 2.98 kB 0 B
debug/dist/debug.umd.js 3.08 kB 0 B
devtools/dist/devtools.js 184 B 0 B
devtools/dist/devtools.module.js 195 B 0 B
devtools/dist/devtools.umd.js 260 B 0 B
dist/preact.js 3.88 kB 0 B
dist/preact.min.js 3.88 kB 0 B
dist/preact.module.js 3.89 kB 0 B
dist/preact.umd.js 3.93 kB 0 B
hooks/dist/hooks.js 1.09 kB 0 B
hooks/dist/hooks.module.js 1.11 kB 0 B
hooks/dist/hooks.umd.js 1.17 kB 0 B
test-utils/dist/testUtils.js 437 B 0 B
test-utils/dist/testUtils.module.js 439 B 0 B
test-utils/dist/testUtils.umd.js 515 B 0 B

compressed-size-action

Copy link
Copy Markdown
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 🙌💯

@marvinhagemeister marvinhagemeister merged commit 251a19a into master Jun 14, 2020
@marvinhagemeister marvinhagemeister deleted the custom-elements-ts branch June 14, 2020 06:55
Copy link
Copy Markdown

@hbroer hbroer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it does its job. I tried the types inside of one of our project and it seems to work as expected.

import {UiIntrinsicElements} from "@private/view-components";

declare module "preact" {
    namespace createElement.JSX {
        interface IntrinsicElements extends UiIntrinsicElements<HTMLAttributes> {}
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New typings broke custom elements for me

4 participants