-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
BugSomething isn't workingSomething isn't working
Description
Describe the bug
No worries, I know there's a simple workaround for now (just add the property to the prototype after the class definition), but still: this is technically a bug
The following snippet comes straight from MDN and uses the correct class syntax to initialize a static property:
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
static displayName = "Point";
static distance(a, b) {
const dx = a.x - b.x;
const dy = a.y - b.y;
return Math.hypot(dx, dy);
}
}However, the observable compiler currently trips over this (it does work for static methods though).
Example: https://observablehq.com/d/bffd1e6e498d8879 (screenshot below for future reference)
To Reproduce
Steps to reproduce the behavior:
- Type the above class into a javascript cell
Expected behavior
Class syntax being in line with official class syntax.
Screenshots
tomlarkworthy
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working
