Figma plugin TypeScript definitions not working properly

I’m working on a basic Figma plugin and running into TypeScript issues. When I try to access properties on selected elements, TypeScript throws errors even though I’ve installed the official type definitions.

Here’s my simple plugin code:

figma.showUI(__html__);

// @ts-ignore
console.log(figma.currentPage.selection[0].borderRadius);

The plugin runs perfectly and gets the corner radius value from the selected object. But when I remove the @ts-ignore comment, TypeScript gives me this error: “Property ‘borderRadius’ does not exist on type ‘SceneNode’.”

I already installed the type definitions as recommended and my tsconfig.json file looks like this:

{
  "compilerOptions": {
    "target": "es6",
    "lib": ["es6", "dom"],
    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/@figma"
    ]
  }
}

Any ideas what could be wrong with my setup?

You’re hitting TypeScript’s type narrowing. It’s not your setup - it’s how you’re accessing the property. Had this same issue building my first plugin. The property you want is cornerRadius, not borderRadius. It only exists on certain node types, so TypeScript won’t let you access it on all SceneNodes. Skip the @ts-ignore and do this: const node = figma.currentPage.selection[0]; if (node && 'cornerRadius' in node) { console.log(node.cornerRadius); }. TypeScript sees you’ve checked the property exists first. Your tsconfig’s fine - just a property name mix-up and type safety doing its job. Spent hours on this exact thing until I caught Figma’s naming quirks.

for sure! this confused me too. remember that borderRadius is not a SceneNode property. you gotta check the type first and use selection.cornerRadius for rectangles. like selecting a RectangleNode first makes it work. Figma’s API naming can be a pain sometimes!

Your TypeScript config looks fine, but you’re accessing properties without checking types first. borderRadius doesn’t exist in Figma’s API - you want cornerRadius. But here’s the real issue: cornerRadius only exists on specific nodes like rectangles and frames, not on the generic SceneNode type that TypeScript sees in your selection array. Don’t use @ts-ignore - just check the node type first. Either cast the node after verifying selection.type === 'RECTANGLE' or use the in operator to check if the property exists. You’ll keep type safety and fix those compilation errors.

Yeah, everyone covered the type checking stuff already. But after years of this, I just quit building complex Figma plugins entirely.

The TypeScript issues aren’t even the worst part. Try maintaining the plugin, handling different node types, syncing data, and dealing with Figma’s API breaking every update.

I automated my whole design workflow instead. Built processes that pull design tokens straight from Figma, sync with our codebase, and auto-generate component docs.

No more debugging property names or fighting with type guards. Just automation running in the background.

Sure, you can fix this with proper type checking. But think bigger - why not automate whatever you’re building this plugin for?

I’ve saved hundreds of hours automating design system workflows instead of building custom plugins that break every few months.

The problem is SceneNode is the base type, but borderRadius only exists on specific nodes like RectangleNode or EllipseNode. You’ve got to check the node type first or cast it properly.

Here’s the fix:

const selection = figma.currentPage.selection[0];
if (selection && selection.type === 'RECTANGLE') {
  const rect = selection as RectangleNode;
  console.log(rect.cornerRadius);
}

Or use a type guard:

if ('cornerRadius' in selection) {
  console.log(selection.cornerRadius);
}

Honestly, Figma plugin development gets messy fast. I’ve been there with complex plugins syncing data between Figma and external services.

Now I just automate everything with Latenode. You can set up workflows that monitor your Figma files, extract design data automatically, and push updates to your dev environment - no custom plugins needed.

I built a system that watches for design changes and auto-generates code snippets. Way cleaner than debugging TypeScript issues in plugins.