Mininal example for babel-plugin-rewire does not work in a Typescript project at StackOverflow
This is a example that uses Babel to transform TypeScript to plain JavaScript, and uses TypeScript for just type-checking. It is recommended to be set via @babel/cli. Babel looks for .js files by default, but this is not configurable withn the Babel config file.
npm run check-types- check types for TypeScript.npm run lint- run the TypeScript linter using thetslint.jsonconfig file.npm run compile- compile the ES6 TypeScript into the/libdirectory.npm test- run the tests using the local.mocharc.jsonconfig file. Babel Config set is insidebabel.config.js.
By specifying --extensions ".ts, .tsx" options, @babel/cli can handle .ts, .tsx files.
According to this issue, you have to create a new js file babel-register.js into the test directory, specify extensions for TypeScript. This cannot be done by just using --require @babel/register.