Skip to content
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

[labs/react] remove StringValued type #3111

Merged
merged 3 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thin-bees-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lit-labs/react': patch
---

Removed the unexposed and unnecessary `StringValued` type used to correlate property names with event listener names.
10 changes: 3 additions & 7 deletions packages/labs/react/src/create-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ const addOrUpdateEventListener = (
* Sets properties and events on custom elements. These properties and events
* have been pre-filtered so we know they should apply to the custom element.
*/
const setProperty = <E extends Element, T>(
const setProperty = <E extends Element>(
node: E,
name: string,
value: unknown,
old: unknown,
events?: StringValued<T>
events?: Events
) => {
const event = events?.[name as keyof T];
const event = events?.[name];
if (event !== undefined) {
// Dirty check event value.
if (value !== old) {
Expand All @@ -84,10 +84,6 @@ const setRef = (ref: React.Ref<unknown>, value: Element | null) => {
}
};

type StringValued<T> = {
[P in keyof T]: string;
};

type Constructor<T> = {new (): T};

/***
Expand Down