Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
chore(build): support setter-only dproperties (#234)
Browse files Browse the repository at this point in the history
This change to React wrapper Babel plugin makes it support setter-only
declared properties or one whose setter is defined first.

Refs #230.
  • Loading branch information
asudoh committed Jan 6, 2020
1 parent 96ebd40 commit 3d92776
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion babel-plugin-create-react-custom-element-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ module.exports = function generateCreateReactCustomElementType(api) {

const metadata = getPropertyMetadata(path);
if (metadata) {
if (!parentPath.isClassProperty() && (!parentPath.isClassMethod() || parentPath.node.kind !== 'get')) {
if (
!parentPath.isClassProperty() &&
(!parentPath.isClassMethod() || (parentPath.node.kind !== 'get' && parentPath.node.kind !== 'set'))
) {
throw parentPath.buildCodeFrameError('`@property()` must target class properties.');
}
declaredProps[parent.key.name] = metadata;
Expand Down

0 comments on commit 3d92776

Please sign in to comment.