Skip to content

Releases: HichemTab-tech/ts-runtime-picker

2.0.4

14 Jan 06:58
fe56a8f
Compare
Choose a tag to compare

What's Changed

  • fix: bump typescript from 5.7.2 to 5.7.3 by @dependabot in #11
  • fix: bump ts-loader from 9.5.1 to 9.5.2 by @dependabot in #12
  • fix: bump @types/node from 22.10.5 to 22.10.6 by @dependabot in #13
  • Bump version to 2.0.4 by @github-actions in #14

Full Changelog: 2.0.3...2.0.4

2.0.3

06 Jan 21:51
bd521ed
Compare
Choose a tag to compare

What's Changed

  • fix: bump vite from 6.0.6 to 6.0.7 by @dependabot in #8
  • fix: bump @types/node from 22.10.2 to 22.10.5 by @dependabot in #9
  • Bump version to 2.0.3 by @github-actions in #10

Full Changelog: 2.0.2...2.0.3

2.0.2

31 Dec 01:10
1d51752
Compare
Choose a tag to compare

What's Changed

  • fix: bump ts-morph from 24.0.0 to 25.0.0 by @dependabot in #5
  • fix: bump vite from 6.0.5 to 6.0.6 by @dependabot in #6
  • Bump version to 2.0.2 by @github-actions in #7

New Contributors

  • @github-actions made their first contribution in #7

Full Changelog: 2.0.1...2.0.2

2.0.1

23 Dec 22:10
5e4a210
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 2.0.0...2.0.1

2.0.0

15 Dec 23:51
Compare
Choose a tag to compare

Release Notes for v2.0.0

🚀 ts-runtime-picker v2.0.0 Released!

We’re excited to announce version 2.0.0 of ts-runtime-picker 🎉! This major release introduces Webpack support and significant improvements to the structure and naming of our imports to ensure consistency and flexibility.

✨ New Features

  • Webpack Support:
    • Added a custom Webpack loader: ts-runtime-picker/webpack-loader.
    • Works seamlessly when added after ts-loader in your Webpack configuration.

💥 Breaking Changes

  • Vite Plugin Import:

    • Previous: import tsRuntimePicker from "ts-runtime-picker/vite-plugin";
    • New: import TsRuntimePickerVitePlugin from "ts-runtime-picker/vite-plugin";
    • The plugin name has been updated to align with naming conventions and improve clarity.
  • Webpack Integration:

    • Previously unsupported, you can now integrate the loader in Webpack:
      {
        test: /\.ts$/,
        use: [
          {
            loader: 'ts-loader',
          },
          {
            loader: 'ts-runtime-picker/webpack-loader', // ts-runtime-picker loader
          },
        ],
      }
    • Ensure ts-runtime-picker/webpack-loader is placed after ts-loader in the use array.

📦 Installation

npm install [email protected]

🛠 How to Upgrade

To migrate from 1.0.x to 2.0.0, follow the steps outlined in the new UPGRADE.md file included in this release.

Credit

  • Special thanks to @mav-rik for the idea of nested interfaces.

1.0.3

15 Dec 20:30
Compare
Choose a tag to compare

Release Notes: v1.0.3 🎉

Date: 12/15/2024


🛠️ Fixes

  • Enhanced Nested Interface Handling:
    • Resolved an issue where createPicker<T>() failed to include properties from interfaces that extended other interfaces. 🎯
    • The transformer now uses TypeScript's TypeChecker to correctly resolve all properties of a given interface, including those inherited through extends.
    • Example:
      interface Base {
          id: string;
          createdAt: Date;
      }
      
      interface User extends Base {
          firstName: string;
          lastName: string;
      }
      
      // `createPicker<User>()` will now correctly pick `id`, `createdAt`, `firstName`, and `lastName`.
    • This fix ensures that deeply nested or extended interfaces are fully supported, making the package more reliable and robust for real-world TypeScript usage.

🚀 Why This Matters

  • Developers can now safely use createPicker<T>() with complex TypeScript types, confident that all relevant properties—whether directly declared or inherited—will be included in the runtime picker.

Thank you for using ts-runtime-picker! Your feedback helps make this package better every day. ❤️

1.0.2

14 Dec 12:09
Compare
Choose a tag to compare

🚀 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

  1. Enhanced Transformer Logic:

    • The transformer now identifies the createPicker function specifically imported from ts-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.
  2. Alias Resolution:

    • Whether you import createPicker directly or alias it (e.g., cp), the transformer will correctly handle it.

🐞 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 from ts-runtime-picker.

🌟 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

  1. Update your package to the latest version:

    npm install ts-runtime-picker@latest
  2. Ensure your vite.config.ts includes the plugin:

    import tsRuntimePicker from "ts-runtime-picker/vite-plugin";
    
    export default {
        plugins: [tsRuntimePicker()],
    };
  3. 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.


1.0.1

13 Dec 23:35
Compare
Choose a tag to compare

🎉 v1.0.1 - Initial Release

We’re excited to announce the first release of ts-runtime-picker! This utility package is designed to help TypeScript developers simplify object filtering at runtime, ensuring that only the properties defined in your TypeScript interfaces are included, removing any unnecessary or unwanted fields.

🚀 Features

  • Runtime Picker Functionality: Automatically removes unwanted properties from objects, keeping only the fields defined in your TypeScript interface.
  • Seamless Integration: Easily integrates into your TypeScript project with minimal configuration.
  • Vite Plugin Support: Includes a Vite plugin for enhanced build-time integration, generating runtime-safe picker functions.
  • Type-Safe: Works fully with TypeScript interfaces and types, ensuring type safety at both compile-time and runtime.

🛠️ Installation

To start using ts-runtime-picker, follow these steps:

  1. Install the Package

    npm install ts-runtime-picker
  2. Add Vite Plugin (if using Vite)
    In your vite.config.ts, import the plugin and include it in the plugins array:

    import { defineConfig } from 'vite';
    import tsRuntimePicker from 'ts-runtime-picker/vite-plugin';
    
    export default defineConfig({
        plugins: [tsRuntimePicker()],
    });

🧑‍💻 Usage

1. Define Your Interface

interface User {
    firstName: string;
    lastName: string;
    age: number;
}

2. Create a Picker

import { createPicker } from 'ts-runtime-picker';

const picker = createPicker<User>();

const request = {
    data: {
        firstName: 'John',
        lastName: 'Doe',
        age: 30,
        extraField: 'This should be removed'
    }
};

const result = picker(request.data);
console.log(result); // { firstName: 'John', lastName: 'Doe', age: 30 }

3. Use the Picker

Now you can use the picker function to filter out any extra properties and send the clean, type-safe object to APIs, databases, or other services.


🐛 Fixed Issues

  • First release of ts-runtime-picker with the core functionality for runtime object filtering based on TypeScript interfaces.

🚀 What's Next

In future versions, we plan to enhance ts-runtime-picker with additional features, including support for custom filtering logic, performance optimizations, and expanded integration with various frameworks.


Feel free to file issues or contribute to the project on GitHub! 🎉


Notes:

  • The v1.0.1 release is the initial version and covers the basic functionality of filtering objects at runtime based on TypeScript interfaces.
  • This release is designed for use with TypeScript and can be integrated into Vite-based projects through the Vite plugin.