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

Skip to content

Conversation

@augustjk
Copy link
Member

This alleviates type errors when there's a different version of reactive-element that @lit/localize is using versus what the user's component is using.

Because localized is a class decorator, the standard Interface with Omit or Pick was not usable as there were static properties on it that conflict. I tried Pick<typeof ReactiveElement, 'addInitializer'> but the initializer type references ReactiveElement directly which breaks because of renderRoot.

I also removed the dependency on @lit/reactive-element and just import everything from lit.

I do wonder though.. @lit/localize only uses the lit package for types/interfaces. It exports utilities strictly meant to be used with lit projects and nothing is standalone. This is a prime candidate for marking lit as a peer dependency as described in lit/rfcs#31.

I tried it locally by updating the package.json to specify lit as a peer dependency, without the loosened type fix npm pack and installed the tarball in a lit 2 test project that was having type errors before. It no longer errors as it did not create a nested duplicate @lit/reactive-element. But, to be fair, this was also the case with just expanding the dependency version to include lit 2 even as a non-peer regular dependency as npm was able to dedupe it then too.

@changeset-bot
Copy link

changeset-bot bot commented Oct 25, 2023

🦋 Changeset detected

Latest commit: 4d8dd8c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lit/localize Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 25, 2023

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: unsure 🔍 -9% - +6% (-1.98ms - +1.33ms)
    this-change vs tip-of-tree

render

  • this-change: 90.90ms - 96.49ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -5% - +4% (-2.02ms - +1.46ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +2% (-1.91ms - +1.58ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +3% (-2.03ms - +1.69ms)
    this-change vs tip-of-tree

update

  • this-change: 1036.97ms - 1057.27ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -6% - +2% (-4.95ms - +1.71ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +4% (-2.97ms - +5.71ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-15.15ms - +14.58ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 1019.45ms - 1041.56ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +2% (-8.66ms - +22.38ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
90.90ms - 96.49ms-

update

VersionAvg timevs
1036.97ms - 1057.27ms-

update-reflect

VersionAvg timevs
1019.45ms - 1041.56ms-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
39.25ms - 41.77ms-unsure 🔍
-5% - +4%
-2.02ms - +1.46ms
unsure 🔍
-4% - +5%
-1.81ms - +2.09ms
tip-of-tree
tip-of-tree
39.59ms - 41.99msunsure 🔍
-4% - +5%
-1.46ms - +2.02ms
-unsure 🔍
-4% - +6%
-1.49ms - +2.33ms
previous-release
previous-release
38.88ms - 41.86msunsure 🔍
-5% - +4%
-2.09ms - +1.81ms
unsure 🔍
-6% - +4%
-2.33ms - +1.49ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
79.10ms - 83.30ms-unsure 🔍
-6% - +2%
-4.95ms - +1.71ms
unsure 🔍
-8% - +2%
-6.55ms - +1.61ms
tip-of-tree
tip-of-tree
80.25ms - 85.40msunsure 🔍
-2% - +6%
-1.71ms - +4.95ms
-unsure 🔍
-6% - +4%
-5.19ms - +3.50ms
previous-release
previous-release
80.17ms - 87.17msunsure 🔍
-2% - +8%
-1.61ms - +6.55ms
unsure 🔍
-4% - +6%
-3.50ms - +5.19ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
20.20ms - 22.05ms-unsure 🔍
-9% - +6%
-1.98ms - +1.33ms
unsure 🔍
-2% - +10%
-0.37ms - +1.98ms
tip-of-tree
tip-of-tree
20.08ms - 22.82msunsure 🔍
-6% - +9%
-1.33ms - +1.98ms
-unsure 🔍
-2% - +13%
-0.42ms - +2.69ms
previous-release
previous-release
19.58ms - 21.05msunsure 🔍
-9% - +2%
-1.98ms - +0.37ms
unsure 🔍
-12% - +2%
-2.69ms - +0.42ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
65.37ms - 67.67ms-unsure 🔍
-3% - +2%
-1.91ms - +1.58ms
unsure 🔍
-2% - +3%
-1.32ms - +1.96ms
tip-of-tree
tip-of-tree
65.37ms - 67.99msunsure 🔍
-2% - +3%
-1.58ms - +1.91ms
-unsure 🔍
-2% - +3%
-1.27ms - +2.24ms
previous-release
previous-release
65.03ms - 67.37msunsure 🔍
-3% - +2%
-1.96ms - +1.32ms
unsure 🔍
-3% - +2%
-2.24ms - +1.27ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
141.06ms - 146.33ms-unsure 🔍
-2% - +4%
-2.97ms - +5.71ms
unsure 🔍
-1% - +5%
-1.08ms - +6.85ms
tip-of-tree
tip-of-tree
138.88ms - 145.77msunsure 🔍
-4% - +2%
-5.71ms - +2.97ms
-unsure 🔍
-2% - +4%
-3.03ms - +6.05ms
previous-release
previous-release
137.85ms - 143.77msunsure 🔍
-5% - +1%
-6.85ms - +1.08ms
unsure 🔍
-4% - +2%
-6.05ms - +3.03ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
65.41ms - 68.18ms-unsure 🔍
-3% - +3%
-2.03ms - +1.69ms
unsure 🔍
-4% - +2%
-2.88ms - +1.51ms
tip-of-tree
tip-of-tree
65.72ms - 68.20msunsure 🔍
-3% - +3%
-1.69ms - +2.03ms
-unsure 🔍
-4% - +2%
-2.62ms - +1.59ms
previous-release
previous-release
65.78ms - 69.18msunsure 🔍
-2% - +4%
-1.51ms - +2.88ms
unsure 🔍
-2% - +4%
-1.59ms - +2.62ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1050.33ms - 1072.53ms-unsure 🔍
-1% - +1%
-15.15ms - +14.58ms
unsure 🔍
-2% - +1%
-24.15ms - +9.30ms
tip-of-tree
tip-of-tree
1051.83ms - 1071.61msunsure 🔍
-1% - +1%
-14.58ms - +15.15ms
-unsure 🔍
-2% - +1%
-23.09ms - +8.81ms
previous-release
previous-release
1056.34ms - 1081.37msunsure 🔍
-1% - +2%
-9.30ms - +24.15ms
unsure 🔍
-1% - +2%
-8.81ms - +23.09ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1062.59ms - 1085.83ms-unsure 🔍
-1% - +2%
-8.66ms - +22.38ms
unsure 🔍
-2% - +2%
-16.80ms - +17.37ms
tip-of-tree
tip-of-tree
1057.06ms - 1077.64msunsure 🔍
-2% - +1%
-22.38ms - +8.66ms
-unsure 🔍
-2% - +1%
-22.78ms - +9.63ms
previous-release
previous-release
1061.40ms - 1086.45msunsure 🔍
-2% - +2%
-17.37ms - +16.80ms
unsure 🔍
-1% - +2%
-9.63ms - +22.78ms
-

tachometer-reporter-action v2 for Benchmarks

@github-actions
Copy link
Contributor

The size of lit-html.js and lit-core.min.js are as expected.

Copy link
Contributor

@AndrewJakubowicz AndrewJakubowicz left a comment

Choose a reason for hiding this comment

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

Awesome!

@augustjk augustjk force-pushed the localize-decorator-fix branch from 1257eb6 to 4d8dd8c Compare October 26, 2023 23:36
@augustjk augustjk enabled auto-merge (squash) October 26, 2023 23:39
@augustjk augustjk merged commit 75943d9 into main Oct 27, 2023
@augustjk augustjk deleted the localize-decorator-fix branch October 27, 2023 00:00
This was referenced Oct 27, 2023
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.

2 participants