typescript-json-serializer: Cannot read property of 'name' of undefined

When I package a simple data transfer to a 3rd party API to an Winx64 .exe via the node pkg package, I get this error.

C:\Users\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\build>registria-win.exe -s "daisy" -b "LIN01" -r "1049315-1049318
TypeError: Cannot read property 'name' of undefined
    at convertDataToProperty (C:\snapshot\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\node_modules\typescript-json-serializer\index.js:164:24)
    at C:\snapshot\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\node_modules\typescript-json-serializer\index.js:92:29
    at Array.forEach (<anonymous>)
    at Object.deserialize (C:\snapshot\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\node_modules\typescript-json-serializer\index.js:90:10)
    at RegistriaData.<anonymous> (C:\snapshot\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\build\registriaData.js)
    at step (C:\snapshot\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\build\registriaData.js)
    at Object.next (C:\snapshot\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\build\registriaData.js)
    at fulfilled (C:\snapshot\Jbaszler\OneDrive\Documents\Personal Stuff\Larson\Code Projects\Registria\registriaBackEnd\build\registriaData.js)

It runs just fine in the dev/debug environment. I’ve attached the few files that are in play for this.
psRegistria.ts.txt registriaData.ts.txt tsconfig.json.txt nodemon.json.txt package.json.txt registria.ts.txt

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

Fixed this by adding “emitDecoratorMetadata”:true to the compiler options in tsconfig.json.

{ “extends”: “./node_modules/gts/tsconfig-google.json”, “compilerOptions”: { “experimentalDecorators”: true, “emitDecoratorMetadata”:true, “target”: “es5”, “rootDir”: “.”, “forceConsistentCasingInFileNames”: false, “outDir”: “build” }, “include”: [ “src//*.ts", "test//*.ts” ] }

Works fine now, @GillianPerard ! I assume it was a peer dependencies depth. That’s one one those weird things you can’t explain properly. 😃

This issue is closable. Thanks for the replies.