Skip to content

v1.2.0

Compare
Choose a tag to compare
@Adedoyin-Emmanuel Adedoyin-Emmanuel released this 13 Feb 09:25
· 9 commits to main since this release

TsFluent v1.2.0 πŸŽ‰

This release introduces powerful type-safe context support and enhanced metadata handling, making TsFluent even more robust and developer-friendly.

🌟 Key Features

Generic Context Support

  • Added TContext generic parameter to both Result and ResultAsync
  • Type-safe context handling in metadata
  • Improved type inference in chaining operations

Enhanced API

  • New property-based access for better DX:
    • result.errors instead of getErrors()
    • result.metadata instead of getMetadata()
  • Improved metadata propagation in transformations
  • Better type safety across all operations

Developer Experience

  • Comprehensive documentation with TypeScript examples
  • Enhanced type safety in method chaining
  • Better error handling with context preservation

πŸ”₯ Example Usage

interface ApiContext {
    requestId: string;
    endpoint: string;
}

const result = await ResultAsync
        .from<Response, ApiContext>(fetch("https://api.example.com/data"))
        .withMetadata({
        context: {
            requestId: "req-123",
            endpoint: "/data"
       }
});

// Type-safe access to context
const context = result.metadata?.context; // Type is ApiContext | undefined

πŸ”§ Breaking Changes

  • Deprecated getErrors() in favor of errors property
  • Deprecated getMetadata() in favor of metadata property

πŸ“ Documentation

Full documentation and examples available in the README