Search code examples
reactjsreact-nativemobxobserversstate-management

React native & MobX: Experimental support for decorators is a feature that is subject [...]. But 'tsconfig' or 'jsconfig' doesn't exist


So my vscode keeps on giving me this error when I tried to implement mobx observer into react native.

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.

I believe that I have followed every instruction in the website below.

https://jamesmargrove.medium.com/setting-up-a-typescript-react-native-project-with-decorators-93eb8a8ffa9

Also I can't find the tsconfig or jsconfig anywhere in my project. Please help

enter image description here


Solution

  • Try adding a jsconfig.json file in the root of the project with the following contents:

    {
      "compilerOptions": {
        "experimentalDecorators": true
      }
    }