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

Skip to content

Conversation

@AndrewJakubowicz
Copy link
Contributor

Context

The StyleInfo interface which styleMap takes as an argument was marked as readonly making the following case (without explicit types) valid:

  render() {
    const styles = {color: 'red'};
    styles.color = 'blue';
    return html`<p style="${styleMap(styles)}">Hello!</p>`;
  }

but the explicitly typed version invalid:

  render() {
    const styles: StyleInfo = {color: 'red'};
    styles.color = 'blue';
    return html`<p style="${styleMap(styles)}">Hello!</p>`;
  }

Playground repro

Fix

Remove readonly from the exported interface, but wrap the styleMap directive StyleInfo argument with Readonly such that our styleMap directive doesn't accidentally modify the object.

Testing

Added a test explicitly adding and removing a property.

@changeset-bot
Copy link

changeset-bot bot commented Mar 22, 2022

πŸ¦‹ Changeset detected

Latest commit: d142ab2

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

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 Mar 22, 2022

πŸ“Š Tachometer Benchmark Results

Summary

nop-update

  • lit-html-kitchen-sink: unsure πŸ” -2% - +2% (-0.64ms - +0.85ms)
    this-change vs tip-of-tree

render

  • lit-element-list: unsure πŸ” -2% - +3% (-1.62ms - +3.13ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure πŸ” -3% - +2% (-1.18ms - +1.11ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure πŸ” -5% - +2% (-0.68ms - +0.24ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure πŸ” -1% - +3% (-1.00ms - +2.32ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure πŸ” -2% - +1% (-1.68ms - +0.99ms)
    this-change vs tip-of-tree

update

  • lit-element-list: unsure πŸ” -1% - +2% (-10.91ms - +18.43ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure πŸ” -0% - +9% (-0.18ms - +10.05ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure πŸ” -2% - +2% (-7.18ms - +6.78ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure πŸ” -3% - +3% (-4.24ms - +4.45ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure πŸ” -2% - +1% (-19.36ms - +10.83ms)
    this-change vs tip-of-tree

update-reflect

  • lit-element-list: unsure πŸ” -2% - +0% (-24.39ms - +3.29ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure πŸ” -1% - +2% (-8.83ms - +23.83ms)
    this-change vs tip-of-tree

Results

lit-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
104.85ms - 108.84ms-unsure πŸ”
-2% - +3%
-1.62ms - +3.13ms
faster βœ”
20% - 25%
27.46ms - 34.72ms
tip-of-tree
tip-of-tree
104.80ms - 107.37msunsure πŸ”
-3% - +2%
-3.13ms - +1.62ms
-faster βœ”
21% - 25%
28.55ms - 35.14ms
previous-release
previous-release
134.90ms - 140.96msslower ❌
25% - 33%
27.46ms - 34.72ms
slower ❌
27% - 33%
28.55ms - 35.14ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1000.05ms - 1023.00ms-unsure πŸ”
-1% - +2%
-10.91ms - +18.43ms
faster βœ”
6% - 9%
63.77ms - 94.09ms
tip-of-tree
tip-of-tree
998.63ms - 1016.91msunsure πŸ”
-2% - +1%
-18.43ms - +10.91ms
-faster βœ”
6% - 9%
69.21ms - 96.16ms
previous-release
previous-release
1080.55ms - 1100.36msslower ❌
6% - 9%
63.77ms - 94.09ms
slower ❌
7% - 10%
69.21ms - 96.16ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1090.98ms - 1110.78ms-unsure πŸ”
-2% - +0%
-24.39ms - +3.29ms
faster βœ”
4% - 6%
48.97ms - 75.91ms
tip-of-tree
tip-of-tree
1101.77ms - 1121.09msunsure πŸ”
-0% - +2%
-3.29ms - +24.39ms
-faster βœ”
3% - 6%
38.59ms - 65.18ms
previous-release
previous-release
1154.19ms - 1172.45msslower ❌
4% - 7%
48.97ms - 75.91ms
slower ❌
3% - 6%
38.59ms - 65.18ms
-
lit-html-kitchen-sink

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
43.81ms - 45.15ms-unsure πŸ”
-3% - +2%
-1.18ms - +1.11ms
faster βœ”
9% - 12%
4.58ms - 6.27ms
tip-of-tree
tip-of-tree
43.58ms - 45.44msunsure πŸ”
-2% - +3%
-1.11ms - +1.18ms
-faster βœ”
9% - 13%
4.33ms - 6.45ms
previous-release
previous-release
49.39ms - 50.41msslower ❌
10% - 14%
4.58ms - 6.27ms
slower ❌
10% - 15%
4.33ms - 6.45ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
116.40ms - 125.99ms-unsure πŸ”
-0% - +9%
-0.18ms - +10.05ms
unsure πŸ”
-3% - +6%
-3.78ms - +7.30ms
tip-of-tree
tip-of-tree
114.47ms - 118.05msunsure πŸ”
-8% - -0%
-10.05ms - +0.18ms
-unsure πŸ”
-5% - +0%
-6.48ms - +0.13ms
previous-release
previous-release
116.65ms - 122.21msunsure πŸ”
-6% - +3%
-7.30ms - +3.78ms
unsure πŸ”
-0% - +6%
-0.13ms - +6.48ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
34.69ms - 35.66ms-unsure πŸ”
-2% - +2%
-0.64ms - +0.85ms
faster βœ”
7% - 12%
2.83ms - 4.55ms
tip-of-tree
tip-of-tree
34.51ms - 35.64msunsure πŸ”
-2% - +2%
-0.85ms - +0.64ms
-faster βœ”
8% - 12%
2.88ms - 4.70ms
previous-release
previous-release
38.16ms - 39.57msslower ❌
8% - 13%
2.83ms - 4.55ms
slower ❌
8% - 14%
2.88ms - 4.70ms
-
lit-html-repeat

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
13.12ms - 13.69ms-unsure πŸ”
-5% - +2%
-0.68ms - +0.24ms
faster βœ”
11% - 16%
1.66ms - 2.56ms
tip-of-tree
tip-of-tree
13.25ms - 13.99msunsure πŸ”
-2% - +5%
-0.24ms - +0.68ms
-faster βœ”
9% - 15%
1.39ms - 2.40ms
previous-release
previous-release
15.17ms - 15.87msslower ❌
12% - 19%
1.66ms - 2.56ms
slower ❌
10% - 18%
1.39ms - 2.40ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
351.29ms - 361.20ms-unsure πŸ”
-2% - +2%
-7.18ms - +6.78ms
faster βœ”
31% - 33%
160.56ms - 176.47ms
tip-of-tree
tip-of-tree
351.54ms - 361.36msunsure πŸ”
-2% - +2%
-6.78ms - +7.18ms
-faster βœ”
31% - 33%
160.39ms - 176.24ms
previous-release
previous-release
518.54ms - 530.98msslower ❌
45% - 50%
160.56ms - 176.47ms
slower ❌
45% - 50%
160.39ms - 176.24ms
-
lit-html-template-heavy

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
68.95ms - 71.51ms-unsure πŸ”
-1% - +3%
-1.00ms - +2.32ms
faster βœ”
14% - 18%
12.05ms - 15.30ms
tip-of-tree
tip-of-tree
68.51ms - 70.63msunsure πŸ”
-3% - +1%
-2.32ms - +1.00ms
-faster βœ”
15% - 19%
12.87ms - 15.80ms
previous-release
previous-release
82.90ms - 84.91msslower ❌
17% - 22%
12.05ms - 15.30ms
slower ❌
18% - 23%
12.87ms - 15.80ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
151.11ms - 157.10ms-unsure πŸ”
-3% - +3%
-4.24ms - +4.45ms
faster βœ”
11% - 15%
19.24ms - 27.76ms
tip-of-tree
tip-of-tree
150.85ms - 157.15msunsure πŸ”
-3% - +3%
-4.45ms - +4.24ms
-faster βœ”
11% - 16%
19.24ms - 27.97ms
previous-release
previous-release
174.58ms - 180.62msslower ❌
12% - 18%
19.24ms - 27.76ms
slower ❌
12% - 18%
19.24ms - 27.97ms
-
reactive-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
75.81ms - 77.71ms-unsure πŸ”
-2% - +1%
-1.68ms - +0.99ms
unsure πŸ”
-1% - +2%
-1.10ms - +1.33ms
tip-of-tree
tip-of-tree
76.16ms - 78.04msunsure πŸ”
-1% - +2%
-0.99ms - +1.68ms
-unsure πŸ”
-1% - +2%
-0.75ms - +1.67ms
previous-release
previous-release
75.88ms - 77.40msunsure πŸ”
-2% - +1%
-1.33ms - +1.10ms
unsure πŸ”
-2% - +1%
-1.67ms - +0.75ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1028.58ms - 1050.44ms-unsure πŸ”
-2% - +1%
-19.36ms - +10.83ms
unsure πŸ”
-2% - +1%
-18.55ms - +14.93ms
tip-of-tree
tip-of-tree
1033.36ms - 1054.19msunsure πŸ”
-1% - +2%
-10.83ms - +19.36ms
-unsure πŸ”
-1% - +2%
-13.95ms - +18.87ms
previous-release
previous-release
1028.64ms - 1054.00msunsure πŸ”
-1% - +2%
-14.93ms - +18.55ms
unsure πŸ”
-2% - +1%
-18.87ms - +13.95ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1145.68ms - 1166.77ms-unsure πŸ”
-1% - +2%
-8.83ms - +23.83ms
unsure πŸ”
-0% - +2%
-5.41ms - +24.50ms
tip-of-tree
tip-of-tree
1136.25ms - 1161.20msunsure πŸ”
-2% - +1%
-23.83ms - +8.83ms
-unsure πŸ”
-1% - +2%
-14.32ms - +18.42ms
previous-release
previous-release
1136.07ms - 1157.28msunsure πŸ”
-2% - +0%
-24.50ms - +5.41ms
unsure πŸ”
-2% - +1%
-18.42ms - +14.32ms
-

tachometer-reporter-action v2 for Benchmarks

@AndrewJakubowicz AndrewJakubowicz marked this pull request as ready for review March 23, 2022 00:03
@AndrewJakubowicz AndrewJakubowicz merged commit a6069c4 into main Mar 23, 2022
@AndrewJakubowicz AndrewJakubowicz deleted the style-info branch March 23, 2022 00:05
This was referenced Mar 31, 2022
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