wire
Decorator doesn't accept WireAdapterConstructor on a adapter
property
#5082
Labels
wire
Decorator doesn't accept WireAdapterConstructor on a adapter
property
#5082
Description
wire
should accept both a direct WireAdapterConstructor and an "indirect" constructor, typically a function that has anadapter
property.This is used on the Salesforce platform when Apex
@AuraEnabled(cacheable=true)
methods are exposed to LWC. They are a function that can be imperatively invoked but have a property ofadapter
which carries the WireAdapterConstructor. The LWC engine knows to look for this property and give it preference.The typings for
wire
don't account for this.Steps to Reproduce
Typescript Playground for LWC Wire Adapter Typings
Expected Results
If I'm passing an imported Apex method to
wire
then I expect it to get the typings correct and use the adapter's config values to validate the parameters passed in thewire
decorator's second parameter.Actual Results
There is no way for me to correctly type the imported Apex method that will be compatible with the current LWC
wire
typings.Version
Possible Solution
I have a comprehensive typing update for wire. It fixes this problem but also fixes several other problems mostly related to how config params are type checked. We can break this up into multiple issues or deal with it all here.
The linked Typescript Playground includes everything. I can create a separate trimmed down version just for this issue if you'd prefer.
The text was updated successfully, but these errors were encountered: