False Positive Inspector Error: Signature Mismatch on ShowToastEvent
Issue #2074
resolved
Upon inspection of our LWC Javascript files that utilize ShowToastEvent, we receive a Weak Warning with the message “Argument type {title: string, message: string} is not assignable to parameter type ShowToastEvent”. The message displays more or fewer items in braces as we expand or shrink the provided argument set, with no set of parameters seemingly being acceptable (though title and message are required at a minimum).
Sample code for replication (warning thrown on line 6):
import {LightningElement} from 'lwc';
import {ShowToastEvent} from "lightning/platformShowToastEvent";
export default class Test_Component extends LightningElement {
sampleMethod() {
return new ShowToastEvent({
title: 'Error',
message: 'Please contact your System Administrator for support.'
});
}
}
No major business/developer impact, just a distraction.
lds.d.ts (66) shows this as the constructor for ShowToastEvent, possibly a source of the issue:
constructor(showToastEvent: ShowToastEvent);
Comments (3)
-
repo owner -
reporter Thank you Scott!
-
repo owner - changed status to resolved
Delivered in 2.2.1.5.
- Log in to comment
Fix committed for inclusion in the next build.