1.0.2
🚀 What's New in v1.0.2?
This release introduces an important improvement to the transformer logic, ensuring that the package operates more accurately and avoids unintended behavior when using createPicker
with aliases or conflicting names.
🔧 Improvements
-
Enhanced Transformer Logic:
- The transformer now identifies the
createPicker
function specifically imported fromts-runtime-picker
. - It supports cases where
createPicker
is aliased (e.g.,import { createPicker as cp }
). - Prevents accidental transformations of unrelated
createPicker
functions from other libraries or user-defined functions.
- The transformer now identifies the
-
Alias Resolution:
- Whether you import
createPicker
directly or alias it (e.g.,cp
), the transformer will correctly handle it.
- Whether you import
🐞 Bug Fixes
- Unintended Transformations:
- Fixed an issue where the transformer could erroneously replace functions named
createPicker
from unrelated sources or other libraries. - The transformer now reliably targets only
createPicker
imported fromts-runtime-picker
.
- Fixed an issue where the transformer could erroneously replace functions named
🌟 Example Scenarios Fixed
✅ Case 1: Correct Import
import { createPicker } from "ts-runtime-picker";
const picker = createPicker<User>();
// ✔️ Works as expected
✅ Case 2: Aliased Import
import { createPicker as cp } from "ts-runtime-picker";
const picker = cp<User>();
// ✔️ Now works with the alias
🚫 Case 3: Conflicting Import
import { createPicker } from "another-library";
const picker = createPicker<User>();
// ❌ Transformer ignores this, as it’s not from `ts-runtime-picker`
🚫 Case 4: Locally Defined Function
function createPicker() {
return "Not related to ts-runtime-picker";
}
const picker = createPicker();
// ❌ Transformer ignores this, as it’s not imported from `ts-runtime-picker`
🛠 How to Upgrade
-
Update your package to the latest version:
npm install ts-runtime-picker@latest
-
Ensure your
vite.config.ts
includes the plugin:import tsRuntimePicker from "ts-runtime-picker/vite-plugin"; export default { plugins: [tsRuntimePicker()], };
-
No further changes are needed—enjoy the improved transformer logic! 🚀
❤️ Thank You!
Thank you for using ts-runtime-picker
! If you encounter any issues, feel free to open an issue on our [GitHub repository](https://github.com/HichemTab-tech/ts-runtime-picker). Your feedback and contributions help us improve the package with each release.