CmisJS icon indicating copy to clipboard operation
CmisJS copied to clipboard

error: TS2749: 'Buffer' refers to a value but is being used as a type here

Open myronu opened this issue 4 years ago • 1 comments

I'm getting these errors when I try to build our project. We are using Angular 8 and Typescript 3.5.3. A search shows a similar error for StringDecoder, which was fixed in @types/node. I just upgraded our version of @types/node to the latest, 13.13.5, and still get the same error.

An unhandled exception occurred: node_modules/cmis/src/cmis.ts(228,50): error TS2749: 'Buffer' refers to a value, but is being used as a type here.
node_modules/cmis/src/cmis.ts(326,34): error TS2749: 'Buffer' refers to a value, but is being used as a type here.
node_modules/cmis/src/cmis.ts(793,32): error TS2749: 'Buffer' refers to a value, but is being used as a type here.
node_modules/cmis/src/cmis.ts(883,32): error TS2749: 'Buffer' refers to a value, but is being used as a type here.
node_modules/cmis/src/cmis.ts(1014,32): error TS2749: 'Buffer' refers to a value, but is being used as a type here.
node_modules/cmis/src/cmis.ts(1092,32): error TS2749: 'Buffer' refers to a value, but is being used as a type here.
node_modules/cmis/src/cmis.ts(1118,32): error TS2749: 'Buffer' refers to a value, but is being used as a type here.

myronu avatar May 12 '20 14:05 myronu

I found the fix, I needed this in tsconfig.json

    "typeRoots": ["node_modules/@types"],
    "types": ["node"],

myronu avatar May 12 '20 15:05 myronu