-
Couldn't load subscription status.
- Fork 423
Description
Description
wire should accept both a direct WireAdapterConstructor and an "indirect" constructor, typically a function that has an adapter 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 of adapter 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 the wire 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
- LWC: 8.12.2
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.