Skip to content

Commit 8084b9f

Browse files
authored
Fix compilation with TypeScript 3.8, which updated custom element types. (#902)
1 parent 0df1580 commit 8084b9f

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"tachometer": "^0.4.16",
5757
"tslint": "^5.20.1",
5858
"typedoc": "^0.14.2",
59-
"typescript": "^3.4.1",
59+
"typescript": "^3.8.2",
6060
"uglify-es": "^3.3.9",
6161
"wct-mocha": "^1.0.0",
6262
"web-component-tester": "^6.9.2"

src/test/lit-element_styling_test.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ suite('Static get styles', () => {
649649

650650
test('can extend and augment `styles`', async () => {
651651
const base = generateElementName();
652-
customElements.define(base, class extends LitElement {
652+
class BaseClass extends LitElement {
653653
static get styles() {
654654
return css`div {
655655
border: 2px solid blue;
@@ -660,18 +660,18 @@ suite('Static get styles', () => {
660660
return htmlWithStyles`
661661
<div>Testing1</div>`;
662662
}
663-
});
664-
663+
}
664+
customElements.define(base, BaseClass);
665665
const sub = generateElementName();
666-
customElements.define(sub, class extends customElements.get(base) {
666+
customElements.define(sub, class extends BaseClass {
667667
static get styles() {
668668
return [
669669
super.styles,
670670
css`span {
671671
display: block;
672672
border: 3px solid blue;
673673
}`
674-
];
674+
] as any;
675675
}
676676

677677
render() {
@@ -682,15 +682,15 @@ suite('Static get styles', () => {
682682
});
683683

684684
const subsub = generateElementName();
685-
customElements.define(subsub, class extends customElements.get(sub) {
685+
customElements.define(subsub, class extends BaseClass {
686686
static get styles() {
687687
return [
688688
super.styles,
689689
css`p {
690690
display: block;
691691
border: 4px solid blue;
692692
}`
693-
];
693+
] as any;
694694
}
695695

696696
render() {
@@ -719,7 +719,7 @@ suite('Static get styles', () => {
719719

720720
test('can extend and override `styles`', async () => {
721721
const base = generateElementName();
722-
customElements.define(base, class extends LitElement {
722+
class BaseClass extends LitElement {
723723
static get styles() {
724724
return css`div {
725725
border: 2px solid blue;
@@ -730,10 +730,11 @@ suite('Static get styles', () => {
730730
return htmlWithStyles`
731731
<div>Testing1</div>`;
732732
}
733-
});
733+
}
734+
customElements.define(base, BaseClass);
734735

735736
const sub = generateElementName();
736-
customElements.define(sub, class extends customElements.get(base) {
737+
customElements.define(sub, class extends BaseClass {
737738
static get styles() {
738739
return css`div {
739740
border: 3px solid blue;
@@ -742,7 +743,7 @@ suite('Static get styles', () => {
742743
});
743744

744745
const subsub = generateElementName();
745-
customElements.define(subsub, class extends customElements.get(sub) {
746+
customElements.define(subsub, class extends BaseClass {
746747
static get styles() {
747748
return css`div {
748749
border: 4px solid blue;
@@ -768,12 +769,13 @@ suite('Static get styles', () => {
768769

769770
test('elements should inherit `styles` by default', async () => {
770771
const base = generateElementName();
771-
customElements.define(base, class extends LitElement {
772+
class BaseClass extends LitElement {
772773
static styles = css`div {border: 4px solid black;}`;
773-
});
774+
}
775+
customElements.define(base, BaseClass);
774776

775777
const sub = generateElementName();
776-
customElements.define(sub, class extends customElements.get(base) {
778+
customElements.define(sub, class extends BaseClass {
777779
render() {
778780
return htmlWithStyles`<div></div>`;
779781
}

0 commit comments

Comments
 (0)