v1.2.0
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 bothResult
andResultAsync
- Type-safe context handling in metadata
- Improved type inference in chaining operations
Enhanced API
- New property-based access for better DX:
result.errors
instead ofgetErrors()
result.metadata
instead ofgetMetadata()
- 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 oferrors
property - Deprecated
getMetadata()
in favor ofmetadata
property
π Documentation
Full documentation and examples available in the README