You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in @lwc/lwc/valid-graphql-wire-adapter-callback-parameter which falsely reports undecorated class methods if their argument is an object with an error property like in this example:
classC{f({ error }){returnerror;}}
The root cause of the issue is that the graphQlDecorator const is initialised as false if decorators === undefined:
// Check that the @wire decorator is using graphqlconstgraphQlDecorator=decorators!==undefined&&// this yields `false`decorators.find((decorator)=>{// this does not run
Which satisfies the condition for verification:
// Verify that the method definition is using 'errors' not 'errorif(graphQlDecorator!==undefined){// this evaluates to `true`
Replacing the decorators !== undefined check with an optional chaining operator fixes the issue.
There is a bug in
@lwc/lwc/valid-graphql-wire-adapter-callback-parameter
which falsely reports undecorated class methods if their argument is an object with anerror
property like in this example:The root cause of the issue is that the
graphQlDecorator
const is initialised asfalse
ifdecorators === undefined
:Which satisfies the condition for verification:
Replacing the
decorators !== undefined
check with an optional chaining operator fixes the issue.An alternative solution without optional chaining:
The text was updated successfully, but these errors were encountered: