Skip to content

Commit

Permalink
Work around TS compiler bug in context (#3691)
Browse files Browse the repository at this point in the history
  • Loading branch information
rictic committed Feb 22, 2023
1 parent 515d5ee commit 4fa0311
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-students-shop.md
@@ -0,0 +1,5 @@
---
'@lit-labs/context': patch
---

Work around a common bug in compilers that target ES5 when extending built in classes like Event.
3 changes: 3 additions & 0 deletions packages/labs/context/src/lib/controllers/context-provider.ts
Expand Up @@ -28,6 +28,9 @@ export class ContextProviderEvent<
*/
public constructor(public readonly context: C) {
super('context-provider', {bubbles: true, composed: true});
// Work around TypeScript compiler bug
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
Object.setPrototypeOf(this, new.target.prototype);
}
}

Expand Down

0 comments on commit 4fa0311

Please sign in to comment.