figma / plugin-typings

Typings for the Figma Plugin API
MIT License
195 stars 45 forks source link

unable to use typings with v 1.39.0 #90

Closed mehimanshupatil closed 2 years ago

mehimanshupatil commented 2 years ago

After updating to the latest version 1.39.0. Typings was not auto resolved. found out /// <reference path="./plugin-api" /> in index.d.ts should contain file extension i.e plugin-api.d.ts or else /// <reference types ="./plugin-api" /> and also const console: Console is conflicting with node.js globals so can you make const to var var console: Console

brianhu-tw commented 2 years ago

yeah, I meet Typing issue, too, change to /// <reference types="./plugin-api" /> will fix it.

JuanDSG commented 2 years ago

Same problem here. Hope they can fix it soon so we can share with our team without nedd to change node_modules manually. Until then I'm going to downgrade to v.1.38.0.

shantsis commented 2 years ago

+1 this issue is still ongoing, I’m having issues with 1.38 too

glebsexy commented 2 years ago

As a workaround, you can use two separate tsconfig.json files for UI and for the backend code since you don't need the DOM lib in the plugin backend and that's what causing the conflict.

mehimanshupatil commented 2 years ago

The node typing is added as you can see in the example https://github.com/figma/plugin-samples/blob/master/webpack-react/package.json must be for the testing library. Anyway, the console conflict is not causing the problem while running or bundling.

panev commented 2 years ago

Getting this when trying to run the tsc: watch - tsconfig.json task with plugin-typings 1.39.0:

node_modules/@figma/plugin-typings/index.d.ts:11:9 - error TS2649: Cannot augment module 'console' with value exports because it resolves to a non-module entity.

11   const console: Console

No issues with older versions.

johndoherty commented 2 years ago

Hi all, sorry for the inconvenience here. Looking into this now.

ymichael commented 2 years ago

Hey! sorry about this, I just published a fix for this and you should be able to fix this by running

npm install @figma/plugin-typings@latest

to pick up the hot fix for this issue. Thanks for reporting this. The fixed version should be 1.39.1

glassesUSA commented 2 years ago

@ymichael

This still appears to be happening for me



11   const console: Console
           ~~~~~~~

  ../../../../usr/local/lib/node_modules/typescript/lib/lib.dom.d.ts:19124:13
    19124 declare var console: Console;
                      ~~~~~~~
    'console' was also declared here.

../../../../usr/local/lib/node_modules/typescript/lib/lib.dom.d.ts:19124:13 - error TS2451: Cannot redeclare block-scoped variable 'console'.

19124 declare var console: Console;
                  ~~~~~~~

  node_modules/@figma/plugin-typings/index.d.ts:11:9
    11   const console: Console
               ~~~~~~~
    'console' was also declared here.

Found 2 errors.
ymichael commented 2 years ago

Hi @glassesUSA , do you mind sharing your tsconfig.json and verifying if an older version worked for you (eg. 1.38.0)

you can install an older version by doing:

npm install @figma/plugin-typings@1.38.0
ymichael commented 2 years ago

I create #96 to track this issue and the follow ups! Lets move the conversation there!