-
Notifications
You must be signed in to change notification settings - Fork 1k
Implement the full CustomElementRegistry type for the ssr shim. #4987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This improves fidelity, and by making the class a declaration rather than an expression, and explicitly implementing the real interface we're able to better cooperate with JSCompiler's renaming.
🦋 Changeset detectedLatest commit: 4f135e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultsthis-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the server-side rendering shim by fully implementing the CustomElementRegistry type, ensuring better type fidelity and improved compatibility with JSCompiler renaming.
- Introduces a full class implementation for CustomElementRegistry with additional methods (getName, upgrade, whenDefined)
- Adds helper types and functions to manage asynchronous element definition resolution
- Updates export statements to align with the new type declarations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/labs/ssr-dom-shim/src/index.ts | Implements a complete CustomElementRegistry type with added methods and helper types for improved fidelity. |
| .changeset/rare-dryers-jump.md | Minor changeset documentation describing the update. |
|
The size of lit-html.js and lit-core.min.js are as expected. |
| let resolve: (value: T) => void; | ||
| let reject: (reason?: unknown) => void; | ||
| const promise = new Promise<T>((res, rej) => { | ||
| resolve = res; | ||
| reject = rej; | ||
| }); | ||
| return {promise, resolve: resolve!, reject: reject!}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi, you can do slightly more compact non-null assertions:
| let resolve: (value: T) => void; | |
| let reject: (reason?: unknown) => void; | |
| const promise = new Promise<T>((res, rej) => { | |
| resolve = res; | |
| reject = rej; | |
| }); | |
| return {promise, resolve: resolve!, reject: reject!}; | |
| let resolve!: (value: T) => void; | |
| let rejec!t: (reason?: unknown) => void; | |
| const promise = new Promise<T>((res, rej) => { | |
| resolve = res; | |
| reject = rej; | |
| }); | |
| return {promise, resolve, reject}; |
This improves fidelity, and by making the class a declaration rather than an expression, and explicitly implementing the real interface we're able to better cooperate with JSCompiler's renaming.