Figma notify with error not according to docs

According to the docs for the notify function:

However, when I add error field I am getting:

Argument of type '{ timeout: number; error: boolean; }' is not assignable to parameter of type 'NotificationOptions'.
  Object literal may only specify known properties, and 'error' does not exist in type 'NotificationOptions'.ts(2345)

I might be doing something wrong here, but looks like a contradiction between docs and error message.

this is the line: figma.notify(errorMessage, {timeout: 5000, error: true});

figma.notify('Your message', {timeout: 4000, error: true});
1 Like

@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.

1 Like