Exploring the pipeline operator implementation in my Typescript project has been quite a journey. Leveraging babel as my trusty transpiler and Typescript as the vigilant type checker was the initial plan.
The quest began with configuring babel to work seamlessly with typescript through the following config files:
//babel.config.json
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"],
"plugins": [
["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]
]
}
and
//tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "out",
// Ensuring creation of .d.ts files by tsc, excluding .js files
"declaration": true,
"emitDeclarationOnly": true,
// Making sure Babel smoothly transpile TypeScript project files
"isolatedModules": true
}
}
Initial success greeted me when I tested the basic functionality. To compile it further, a line was added into the package.json file:
"scripts": { "build": "tsc && babel --extensions ".ts" index.ts -d dist" }
However, challenges arose when I attempted to integrate the pipeline operator into the project. While compiling solely with babel using a specific command proved successful:
babel --extensions ".ts" index.ts -d dist"
dilemmas emerged regarding how to continue utilizing Typescript as the type checker, given its unfamiliarity with babel's pipeline operator. Is there a way to bridge this gap effectively?