#Property 'createDecorator' does not exist on type 'typeof Reflector'.ts(2339)

11 messages · Page 1 of 1 (latest)

chrome peak
#

I'm trying to create a decorator to use with my guards, but the createDecorator method doesn't exist.

{
  "compilerOptions": {
    "module": "CommonJS",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2021",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "paths": {
      "~/*": ["./src/*"]
    }
  }
livid condor
#

I looked everywhere here for this library called Reflector, are you sure you are importing the correct lib and following the documentation?

chrome peak
#

I implemented a custom decorator in another project, like the example below that I found in the documentation

#

for some reason, the method in the Reflector class doesn't exist in this project

livid condor
#

But strange, I tested it here now and it works ok, see if your eslint is not causing any problem, if there is any extension in vscode causing a problem or even check if all dependencies are correctly installed in compatible versions

#

I know it sounds silly, but sometimes VSCode itself is buggy, so you restart everything, clear the cache, delete node_modules, and the lock file, and then do npm install again. Anyway...

#

All my settings.