mobx-decorators
mobx-decorators copied to clipboard
Unable to use @allObservable in Typescript with react-scripts-ts
I'm trying to use the decorator:
import { allObservable } from "mobx-decorators"
@allObservable
export default class AppState {
public search?: string;
constructor() {
this.search = null as any;
}
}
const appState = new AppState();
I get this error in browser:
TypeError: __WEBPACK_IMPORTED_MODULE_9__core_AppState__.a is not a constructor
but build passes OK My tsconfig:
{
"compilerOptions": {
"baseUrl": ".",
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": [ "es6", "dom" ],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"esModuleInterop": true,
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": false,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"importHelpers": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
"build",
"public",
"scripts",
"acceptance-tests",
"webpack",
"jest",
"src/setupTests.ts",
"src/semantic"
]
}