/* eslint-disable @typescript-eslint/no-unused-vars */
import { noChange, nothing } from 'lit';
import { directive, Directive, PartType } from 'lit/directive.js';
class IfPropertyDirective extends Directive {
    constructor(partInfo) {
        super(partInfo);
        if (partInfo.type !== PartType.PROPERTY) {
            throw new Error('ifProperty() can only be used in a property setter');
        }
    }
    update(part, [props]) {
        // const element = part.element as HTMLElement;
        if (props === undefined) {
            // (element as any)[part.name] = undefined;
            return noChange;
        }
        return props;
    }
    render(_value) {
        // nothing.
        return nothing;
    }
}
/**
 * Ignores setting a property that is `undefined`.
 *
 * This only works when setting properties.
 *
 * @param property
 */
export const ifProperty = directive(IfPropertyDirective);
//# sourceMappingURL=if-property.js.map