Babel plugin that transforms optional chaining expressions (e.g., `obj?.prop`) for TypeScript using the ts-optchain approach. Version 1.1.5 (latest) is stable but unmaintained since 2020. Provides an alternative to TypeScript's native optional chaining for environments that don't support it, by converting `?.` into `_` wrapped calls. Works only with Babel, not tsc. No dependencies. Not recommended for new projects; prefer native optional chaining.
npm install babel-plugin-ts-optchainVerified import paths — ran on the pinned version, not inferred.
Shows installation, Babel config, and usage with ts-optchain's oc function for safe optional access.
Migrate to native optional chaining and remove babel-plugin-ts-optchain.
Run: npm install ts-optchain babel-plugin-ts-optchain
Remove the plugin and use TypeScript's native ?. operator.
Ensure babel.config.js includes the ts-optchain plugin and that you are using the correct Babel parser. Example: { plugins: ['ts-optchain'] }Install the package: npm install ts-optchain
Invoke the last property access as a function: oc(obj).a.b()
No dependency data recorded yet.