-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not resolve detected property at runtime #130
Comments
You are using both TypeScript and Babel? Perhaps that is where the problem lies. What do you need Babel for that TypeScript cannot do? |
@MatthiasKunnen I added the babel plugin because I was getting this error |
Hi @edwardigates, would you mind creating a simplified example repository? It is hard for me to find a cause for the error without looking at configuration files, especially that it uses react, and big frameworks have tendency to add custom build steps on top of tsc. Regarding babel, I must say that I have not tested TypedJSON with babel, only using the regular typescript compiler. I know that in the past babel had limited typescript support, not sure what the status is today, but you might need to specify types manually as I think integration with |
@edwardigates, could you elaborate on why you are using babel on top of TypeScript? Or am I misunderstanding and is your stack different? |
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"
]
} |
@jeromeheissler Thank you so much for posting this, saved my day. |
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:
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?
The text was updated successfully, but these errors were encountered: