figma.notify('Your message', {timeout: 4000, error: true});
@tank666 yes, this is my line I just edited my question, interesting enough it works without error
field, but of course it is not showed in red as an error.
Even more interesting, if I navigate inside the implementation of the notify function I can see:
notify(message: string, options?: NotificationOptions): NotificationHandler
and for NotificationOptions I can also see a couple of implementations, none of them has the error
property.
from lib.dom.d.ts:
interface NotificationOptions {
actions?: NotificationAction[];
badge?: string;
body?: string;
data?: any;
dir?: NotificationDirection;
icon?: string;
image?: string;
lang?: string;
renotify?: boolean;
requireInteraction?: boolean;
silent?: boolean;
tag?: string;
timestamp?: EpochTimeStamp;
vibrate?: VibratePattern;
}
from index.d.ts
interface NotificationOptions {
timeout?: number
}
Update plugin-typings or add error?: boolean;
to the index.d.ts
file.
Update plugin-typings as suggested by @tank666 makes it work with error
field, thanks man!
Did you actually manage to close error message after timeout? For me, it looks like timeout is being ignored for error messages and they need to be closed by the user.
@Ryba, Figma has fixed this and now the error notification will close after a timeout.