The bit/envs/compilers/typescript compiler should support decorators contained within exported components.
The components compile fine, however at runtime in both the playground and when installing via npm/yarn the resulting component does not work correctly. The decorators do not seem to fire properly.
I have two example components hosted on a public bit collection, both using MobX.
The first example - https://bit.dev/seaal/test/mobx-test - uses MobX decorators and does not work correctly in the playground or when downloaded as a package.
The second example - https://bit.dev/seaal/test/mobx-test-no-decorator - uses MobX but does not use decorators and works correctly both in the playground and when downloaded as a package.
Basic reproduction steps of how to recreate this issue from scratch are below:
npx create-react-app mobx-test --typescript"experimentalDecorators": true to the tsconfig.jsonyarn add mobx mobx-react/npm install mobx mobx-react --savev14.0.4v10.11.0v1.15.2Windows 10 Pro - 64 Bitbit/envs/compilers/typescript v0.05@Seaal Thanks for this, I'll add this to the config and publish a new version of the compiler.
Also, there is another version of the ts compiler I did which also generated the d.ts files as part of the compile process (so the dist folder will have the d.ts files).
I didn't test it enough and the performance is not great but feel free to take a look and try it.
https://bit.dev/bit/envs-dev/compilers/typescript
Also, there is another version of the ts compiler I did which also generated the d.ts files as part of the compile process (so the dist folder will have the d.ts files)
@GiladShoham does that mean that we don't need to manually add the d.ts files to our component?
@fabgallo yes:)
@fabgallo We released a new react-typescript compiler with a new typescript version and better configuration that also supports experimentalDecorators.
For the auto-generate d.ts files you still need to wait, this is in progress.
You can see your components working with the typescript compiler here:
https://bit.dev/joshk/typescript-test1/mobx-test
https://bit.dev/joshk/typescript-test1/mobx-test-no-dec
Link to react-typescript compiler https://bit.dev/bit/envs/compilers/react-typescript
@JoshK2 thanks! We'll test it in our upcoming sprint.
Most helpful comment
@JoshK2 thanks! We'll test it in our upcoming sprint.