Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/healthy-dingos-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lit/localize': patch
---

Loosen type for the `@localized()` decorator to be able to decorate any `ReactiveControllerHost` which also alleviates type errors that could arise with multiple copies of `@lit/reactive-element` present in the project. Also remove dependency on `@lit/reactive-element` as it is already covered by the `lit` dependency.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/localize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
"/init/"
],
"dependencies": {
"@lit/reactive-element": "^1.0.0 || ^2.0.0",
"lit": "^2.0.0 || ^3.0.0"
}
}
7 changes: 4 additions & 3 deletions packages/localize/src/internal/localized-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import {updateWhenLocaleChanges} from './localized-controller.js';

import type {ReactiveElement} from '@lit/reactive-element';
import type {ReactiveControllerHost} from 'lit';

/**
* Generates a public interface type that removes private and protected fields.
Expand All @@ -17,9 +17,10 @@ export type Interface<T> = {
[K in keyof T]: T[K];
};

type ReactiveElementClass = Interface<typeof ReactiveElement> & {
type ReactiveElementClass = {
addInitializer(initializer: (element: ReactiveControllerHost) => void): void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
new (...args: any[]): Interface<ReactiveElement>;
new (...args: any[]): ReactiveControllerHost;
};

export type LocalizedDecorator = {
Expand Down