Open wjhsf opened 3 months ago
This is actually subtle. You can use an @wire
with a getter/setter in the following ways:
In all three cases, the wire works as expected but an error is logged:
Invalid @wire value field. Found a duplicate accessor with the same name.
Since this is behavior we support (and I don't see any reason not to support it – a getter/setter is roughly the same as a class property), I would propose we don't remove it and instead get rid of the error-logging.
Based on the tests for the error message BTW, it looks like the intention was to prevent truly egregious mistakes like this one:
~Currently, using
@wire
on a getter or a setter successfully compiles, but it fails at runtime with "Error: [LWC error]: Invalid@wire
dataProp field. Found a duplicate accessor with the same name." To prevent deploying faulty code, this error should be caught at compile time.~Currently, using
@wire
on a getter or a setter works, but it logs a misleading error at runtime, "Error: [LWC error]: Invalid@wire
dataProp field. Found a duplicate accessor with the same name." This error should not be logged.