Tag

generic programming

0 views collected around this technical thread.

Code Mala Tang
Code Mala Tang
Sep 24, 2024 · Frontend Development

Why Avoid the Generic Function Type in TypeScript and What to Use Instead

This article explains why using the generic Function type in TypeScript can break type safety, demonstrates better alternatives with explicit signatures, shows practical examples with generic sum functions and YouTube video data, and highlights the advantages of TypeScript's type inference and utility types.

Best PracticesType Safetyfunction types
0 likes · 7 min read
Why Avoid the Generic Function Type in TypeScript and What to Use Instead
Code Mala Tang
Code Mala Tang
Sep 23, 2024 · Frontend Development

Mastering TypeScript’s infer: How to Extract Types Automatically

This article explains the TypeScript infer keyword, how it works within conditional types to automatically extract type information, and provides detailed examples for array element inference, function return types, and parameter extraction, highlighting its benefits for flexible and type‑safe code.

conditional typesgeneric programminginfer
0 likes · 9 min read
Mastering TypeScript’s infer: How to Extract Types Automatically
DaTaobao Tech
DaTaobao Tech
Jul 26, 2024 · Frontend Development

Practical TypeScript Techniques for Developers

The article offers a hands‑on guide to essential TypeScript patterns—using never for exhaustive switches, XOR for mutually exclusive unions, smart literals, the satisfies keyword, template‑string unions, interface remapping, infer‑based extraction, built‑in utilities, and correctly typed generic React components—complete with ready‑to‑copy code examples.

React componentsType SafetyUtility Types
0 likes · 10 min read
Practical TypeScript Techniques for Developers
Tencent Cloud Developer
Tencent Cloud Developer
Jun 22, 2022 · Fundamentals

Understanding C++ Customization Points: CPO, tag_invoke, and Ranges

This article explains how modern C++ libraries achieve extensible interfaces using Customization Point Objects and the tag_invoke mechanism, compares classic techniques, details the implementation of ranges::begin, and shows how tag_invoke provides a scalable, concept‑friendly alternative for generic library design.

C++CPOCustomization Point Object
0 likes · 17 min read
Understanding C++ Customization Points: CPO, tag_invoke, and Ranges