I'm trying to load the font but getting this error

Argument of type 'FontName | unique symbol' is not assignable to parameter of type 'FontName'. Type 'typeof figma.mixed' is not assignable to type 'FontName'.ts(2345)

Here’s my code.

  (async () => {

    const text = figma.createText()
    await figma.loadFontAsync(text.fontName)

    text.characters = link

There is no Plugin API bug here. This code works as expected and you can check it yourself (just run the plugin with this code). You are getting this Typescript error only in your IDE. I can’t tell you for sure because I don’t use Typescript, but it looks like you should follow the rules and syntax of that language.

Usual arrow. I just used type conversion :slight_smile: as FontName

I just used type conversion : ) as FontName


First of all, I’m using the IDE recommended by Figma.

Secondly, I picked the code exactly from Figma’s API docs, I’m sure there’s no syntax error there.

Thirdly, I did run the plugin, it’s not working.

I ended up doing that and it worked. Thanks :heart::heart:

1 Like

As I said, this code works as expected.