question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not resolve detected property at runtime

See original GitHub issue

Hi, I’m using this library with React-Native and I followed the instructions here. However when I try to run the project I get an error syaing: @jsonMember on AppFile.Id could not resolve detected property constructor at runtime. Are you sure, that you have both "experimentalDecorators" and "emitDecoratorMetadata" in your tscofig.json? .

This is my model for AppFile:

import 'reflect-metadata';
import { jsonObject, jsonMember, TypedJSON } from 'typedjson';

@jsonObject
export class AppFile {

    @jsonMember
    Id?: string;

    @jsonMember
    Group?: string;

    @jsonMember
    Name?: string;

    @jsonMember
    Value?: string;
    
    @jsonMember
    Active?: boolean;

    @jsonMember
    CacheTime?: number;
}

I added "experimentalDecorators": true and "emitDecoratorMetadata": true in tsconfig.josn. I also added "plugins": [ ["@babel/plugin-proposal-decorators", { "legacy": true }]] in babel.config.js.

But nothing seems to work, what is the problem with my setup?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jeromeheisslercommented, Jul 22, 2020

I fix this issue by adding babel-plugin-transform-typescript-metadata

{
  "plugins": [
    ...
    ["babel-plugin-transform-typescript-metadata"],
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    ["@babel/plugin-proposal-class-properties", { "loose": true }]
  ],
  "presets": [
    "module:metro-react-native-babel-preset"
  ]
}
0reactions
florianbepunktcommented, Aug 20, 2020

@jeromeheissler Thank you so much for posting this, saved my day.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypedJSON: "could not resolve detected property constructor ...
I'm trying to add TypedJSON to a react.js app. My calls to serialize are failing because of error messages like
Read more >
Developers - Could not resolve detected property at runtime -
Hi, I'm using this library with React-Native and I followed the instructions here. However when I try to run the project I get...
Read more >
Troubleshooting .NET Framework Targeting Errors - MSBuild
This topic describes MSBuild errors that might occur because of reference issues and how you can resolve those errors.
Read more >
System Properties - Essential Java Classes
System properties include information about the current user, the current version of the Java runtime, and the character used to separate components of...
Read more >
AOT metadata errors - Angular
Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler. The compiler found...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found