dillon1000/react
Commit
Browse files [sprout] Add support for fbt
Fbt + typescript [seems](https://github.com/facebook/fbt/issues/49) [to be](https://github.com/facebook/sfbt/issues/72) a non-blessed workflow. We do want to allow for both flow and typescript tests, so I followed some instructions [from a guide](https://dev.to/retyui/how-to-add-support-typescript-for-fbt-an-internationalization-framework-3lo0) to add support. - fbt tags desugar to.. "fbt" strings. By default, typescript removes unused imports at parse step (and on autoformat steps). We pass special babel-typescript configs and change vscode settings to mitigate this. - I tried adding `fbt` to the global scope, but the fbt transform asserts that `fbt` is actually imported in the source program. - Other hacks are available, like saying we'll only allow for fbt in flow files, or always patching the source code to have an "fbt" import. This seemed the most reasonable and easiest to debug / follow when writing tests
Changed paths6 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/tsconfig.json ModifiedM compiler/packages/sprout/package.json ModifiedM compiler/packages/sprout/src/runner-evaluator.ts ModifiedM compiler/packages/sprout/src/runner-worker.ts ModifiedM compiler/packages/sprout/src/shared-runtime.ts ModifiedM compiler/yarn.lock ModifiedPatch
Files changed
Rendering syntax-highlighted changes…