Skip to main content

Hey folks I’m trying to create a Reaction with a keyboard keypress Trigger in my plugin:


  let reaction = {
action: nodeAction,
trigger: {
type: 'ON_KEY_DOWN',
device: 'KEYBOARD',
keyCodes: :83]
}
};

But I get the following build error when I use the above code:


Type '"ON_KEY_DOWN"' is not assignable to type '"ON_CLICK" | "ON_HOVER" | "ON_PRESS" | "ON_DRAG" | "AFTER_TIMEOUT" | "MOUSE_ENTER" | "MOUSE_LEAVE" | "MOUSE_UP" | "MOUSE_DOWN"'.

ON_KEY_DOWN is defined as a valid Trigger type in the docs but the plugin API doesn’t reflect that. Any idea how I can get this working?

Does it work from the console or without TypeScript, if you just write the JS code? If it does, it might be an error in the typings file which can be reported by opening an issue here: https://github.com/figma/plugin-typings


Hey Gleb turns out I was running an outdated version of typings. Updating it resolved the issue. 🙂


Reply