Collection83 items

marius-townhouse/effective-typescript-skills

View on GitHub
5stars

🎯Skills83

🎯tsdoc-comments🎯Skill

Generates TypeScript documentation comments (TSDoc) to explain public APIs, complex types, and provide comprehensive code documentation with IDE tooltips.

tsdoc-comments
🎯type-display-attention🎯Skill

Displays and simplifies complex TypeScript types to improve IDE readability and developer experience.

type-display-attention
🎯async-over-callbacks🎯Skill

Transforms callback-based asynchronous code into clean, readable async/await patterns for better type flow and error handling.

async-over-callbacks
🎯code-gen-independent🎯Skill

Generates JavaScript code despite TypeScript type errors and demonstrates that TypeScript types are erased at runtime, requiring alternative type checking strategies.

code-gen-independent
🎯create-objects-all-at-once🎯Skill

Efficiently initializes multiple TypeScript objects simultaneously using concise object literal syntax and spread operators.

create-objects-all-at-once
🎯module-by-module-migration🎯Skill

Guides developers through systematic TypeScript module migration, breaking down complex refactoring into manageable, incremental steps.

module-by-module-migration
🎯ts-js-relationship🎯Skill

Explains TypeScript's relationship to JavaScript, highlighting how it adds static typing and catches errors before runtime while remaining fully compatible with JavaScript code.

ts-js-relationship
🎯type-safe-monkey-patching🎯Skill

Enables type-safe runtime extension of global objects and DOM elements in TypeScript without sacrificing type checking or using `as any`.

type-safe-monkey-patching
🎯context-type-inference🎯Skill

Helps restore precise type context when extracting values, preventing type inference errors through annotations, const assertions, and type preservation techniques.

context-type-inference
🎯precise-string-types🎯Skill

Enforces strict string type constraints and prevents unintended string type conversions in TypeScript projects.

precise-string-types
🎯variadic-tuple-types🎯Skill

Demonstrates advanced TypeScript tuple type techniques for creating flexible function signatures with varying argument lengths and types.

variadic-tuple-types
🎯imprecise-over-inaccurate🎯Skill

Prioritizes approximate solutions that provide meaningful insights over precisely incorrect calculations in TypeScript development.

imprecise-over-inaccurate
🎯valid-state-types🎯Skill

Validates TypeScript state types to ensure type safety and prevent runtime errors in complex state management scenarios.

valid-state-types
🎯excess-property-checking🎯Skill

Validates object literal assignments by enforcing strict type checking against defined interfaces, preventing unintended property additions.

excess-property-checking
🎯function-type-expressions🎯Skill

That helps developers precisely precise and type expressions for signatures, ensuring type safety and improving code clarity.

function-type-expressions
🎯different-variables-types🎯Skill

Helps developers use distinct variables with specific types, preventing type ambiguity and improving code clarity by avoiding variable reuse.

different-variables-types
🎯avoid-inferable-annotations🎯Skill

Helps developers remove redundant type annotations, letting TypeScript infer types automatically to keep code clean and concise.

avoid-inferable-annotations
🎯evolving-types🎯Skill

Tracks and narrows variable types dynamically as code executes, especially for initially empty arrays and untyped variables.

evolving-types
🎯type-value-space🎯Skill

Validates TypeScript type definitions by checking type-value spacing and ensuring consistent formatting across code files.

type-value-space
🎯conditional-types-over-overloads🎯Skill

Leverages conditional types to create flexible, union-aware type signatures that handle multiple input and return type scenarios more precisely than function overloads.

conditional-types-over-overloads
🎯tsconfig-options🎯Skill

Explains and demonstrates TypeScript configuration options for optimizing project setup and compiler behavior in tsconfig.json.

tsconfig-options
🎯prefer-type-annotations🎯Skill

Enforces TypeScript type annotations for function parameters and return types to improve code clarity and catch potential type-related errors early.

prefer-type-annotations
🎯hide-unsafe-assertions🎯Skill

Hides unsafe type assertions in function implementations while maintaining clean, well-typed public APIs.

hide-unsafe-assertions
🎯avoid-unnecessary-type-params🎯Skill

Identifies and eliminates unnecessary type parameters in TypeScript to improve type inference and code clarity.

avoid-unnecessary-type-params
🎯control-union-distribution🎯Skill

Prevents unexpected union type distribution in TypeScript conditional types, controlling how boolean, never, and recursive generic types behave.

control-union-distribution
🎯use-readonly🎯Skill

Prevents data mutations by using TypeScript's readonly to catch and signal unintended modifications to arrays and objects.

use-readonly
🎯accurate-environment-model🎯Skill

Generates a precise TypeScript environment model with accurate type inference and comprehensive configuration validation.

accurate-environment-model
🎯exclusive-or-properties🎯Skill

Demonstrates and explains the exclusive OR (XOR) bitwise operation properties and use cases in TypeScript with clear code examples.

exclusive-or-properties
🎯avoid-numeric-index🎯Skill

Prevents using numeric index signatures by guiding developers to use Array, tuple, or ArrayLike types that accurately reflect JavaScript's string-based indexing.

avoid-numeric-index
🎯dom-hierarchy🎯Skill

Explores and visualizes the Document Object Model (DOM) hierarchy, providing insights into web page structure and element relationships.

dom-hierarchy
🎯type-narrowing🎯Skill

Narrows union types and nullable values in TypeScript by refining types automatically through control flow analysis without using type assertions.

type-narrowing
🎯understand-type-widening🎯Skill

Explores and demonstrates TypeScript's type widening behavior, explaining how types are inferred and expanded during variable assignment.

understand-type-widening
🎯runtime-type-reconstruction🎯Skill

Reconstructs TypeScript runtime types dynamically, enabling precise type inference and runtime type checking for complex generic and conditional types.

runtime-type-reconstruction
🎯distinct-special-values🎯Skill

Enforces using null, undefined, or tagged unions instead of sentinel values like -1 or "" to represent special cases in TypeScript.

distinct-special-values
🎯generics-as-functions🎯Skill

Constrains and transforms types like functions, using generics to create flexible, reusable type utilities with clear input restrictions.

generics-as-functions
🎯tagged-unions🎯Skill

Enforces type safety by converting interfaces with union properties into explicit, type-checked tagged unions.

tagged-unions
🎯types-as-sets🎯Skill

Reasons about TypeScript types using set theory, clarifying type relationships, unions, intersections, and assignability through a mathematical lens.

types-as-sets
🎯type-coverage🎯Skill

Measure and improve TypeScript type safety by tracking the percentage of symbols with real types vs `any`.

type-coverage
🎯no-null-in-aliases🎯Skill

Prevents using `null` in type aliases, enforcing stricter type safety and reducing potential null-related runtime errors.

no-null-in-aliases
🎯structural-typing🎯Skill

Enables understanding and leveraging TypeScript's structural typing by revealing how types are compared based on shape, not explicit declaration.

structural-typing
🎯source-maps-debugging🎯Skill

Enables precise TypeScript debugging by generating source maps that map compiled JavaScript back to original TypeScript code for accurate error tracking and breakpoints.

source-maps-debugging
🎯index-signature-alternatives🎯Skill

Provides TypeScript type alternatives to index signatures, offering more precise and type-safe ways to define object types with dynamic keys.

index-signature-alternatives
🎯dry-types🎯Skill

Derives and transforms TypeScript types using built-in type operations to eliminate type duplication and maintain a single source of truth.

dry-types
🎯currying-inference🎯Skill

Enables advanced TypeScript type inference by strategically creating new inference sites using classes and curried functions.

currying-inference
🎯write-modern-javascript🎯Skill

Generates modern, efficient JavaScript by leveraging TypeScript's compilation and downleveling capabilities for optimal browser compatibility and bundle size.

write-modern-javascript
🎯precise-any-variants🎯Skill

Precisely narrow down broad `any` types to more specific variants like `any[]`, `Record<string, any>`, or `() => any` for improved type safety.

precise-any-variants
🎯record-types-sync🎯Skill

Synchronizes and validates properties across data structures using TypeScript record types, ensuring comprehensive updates and type safety.

record-types-sync
🎯soundness-traps🎯Skill

Helps developers identify and mitigate TypeScript type system limitations by revealing potential runtime errors and unsound type behaviors.

soundness-traps
🎯branded-types🎯Skill

Enforces semantic type distinctions for primitives, preventing type confusion and enabling nominal typing with zero runtime cost.

branded-types
🎯exhaustiveness-checking🎯Skill

Enforces complete handling of union types by using `never` to catch unhandled cases at compile-time, preventing silent omissions.

exhaustiveness-checking
🎯allowjs-mixing🎯Skill

Enables gradual TypeScript migration by mixing JavaScript and TypeScript files in the same project, allowing incremental conversion of codebases.

allowjs-mixing
🎯compiler-performance🎯Skill

Optimize TypeScript compilation performance by leveraging project references, strategic tsconfig settings, and avoiding expensive type patterns.

compiler-performance
🎯iterate-objects-safely🎯Skill

Safely iterate over object keys and values with type-aware techniques, avoiding common TypeScript iteration pitfalls.

iterate-objects-safely
🎯liberal-accept-strict-return🎯Skill

Enables flexible input handling while enforcing precise, non-optional return types for more predictable and type-safe function signatures.

liberal-accept-strict-return
🎯type-vs-interface🎯Skill

Helps developers choose between TypeScript's `type` and `interface` by providing clear guidelines for object type definitions and type composition.

type-vs-interface
🎯push-null-to-perimeter🎯Skill

Pushes nullable values to type boundaries, simplifying null handling and preventing scattered null checks in code.

push-null-to-perimeter
🎯unify-types🎯Skill

Unifies and standardizes TypeScript type definitions across a project, ensuring consistent type usage and reducing type-related complexity.

unify-types
🎯ts-check-jsdoc-experiment🎯Skill

Enables gradual TypeScript type checking in JavaScript files using @ts-check and JSDoc annotations without full conversion.

ts-check-jsdoc-experiment
🎯ecmascript-over-typescript-features🎯Skill

Guides developers to prefer standard ECMAScript features over TypeScript-specific runtime constructs while maintaining strong type safety.

ecmascript-over-typescript-features
🎯avoid-wrapper-types🎯Skill

Prevents unnecessary wrapper type usage by recommending direct primitive types over their object counterparts in TypeScript.

avoid-wrapper-types
🎯functional-constructs-types🎯Skill

Explores advanced functional programming techniques and type system features in TypeScript for creating more robust and expressive code.

functional-constructs-types
🎯narrow-any-scope🎯Skill

Narrows and contains any types to minimize type safety risks when working with untyped libraries or complex type scenarios.

narrow-any-scope
🎯consistent-aliases🎯Skill

Ensures consistent type narrowing and runtime behavior by using a single, consistent alias for object properties.

consistent-aliases
🎯test-your-types🎯Skill

Helps developers write and validate TypeScript type declarations by testing type logic, ensuring type correctness and catching potential errors early.

test-your-types
🎯three-versions-types🎯Skill

Diagnose and resolve TypeScript type declaration version conflicts by aligning package, @types, and TypeScript compiler versions.

three-versions-types
🎯callback-this-type🎯Skill

Explicitly types and documents the `this` context in callbacks, enabling better type safety and autocompletion for library and event handler functions.

callback-this-type
🎯codegen-over-complex-types🎯Skill

Generates type definitions from complex schemas, reducing manual type maintenance and compile-time complexity by automating type synchronization with external data sources.

codegen-over-complex-types
🎯limit-optional-properties🎯Skill

Enforces optional property constraints in TypeScript to prevent unintended undefined values and improve type safety.

limit-optional-properties
🎯no-type-in-docs🎯Skill

Prevents redundant type information in comments, documentation, and variable names by leveraging TypeScript's type system for clear, concise documentation.

no-type-in-docs
🎯domain-language-types🎯Skill

Helps developers name types using domain-specific language, transforming technical structure names into meaningful, expert-understandable type names.

domain-language-types
🎯editor-interrogation🎯Skill

Interactively explores TypeScript type inference by using editor hover, definition navigation, and refactoring tools to understand code behavior.

editor-interrogation
🎯prefer-unknown-over-any🎯Skill

Enforces using `unknown` instead of `any` to improve type safety and catch potential runtime errors in TypeScript code.

prefer-unknown-over-any
🎯type-checking-vs-testing🎯Skill

Guides developers in strategically using type checking and unit testing to catch different types of errors and validate code assumptions.

type-checking-vs-testing
🎯tail-recursive-generics🎯Skill

Implements tail-recursive generic functions with type-safe recursion strategies for efficient and memory-optimized TypeScript code.

tail-recursive-generics
🎯export-public-types🎯Skill

Exports all types used in public function signatures, return types, and interfaces to enable type referencing and improve library usability.

export-public-types
🎯module-augmentation🎯Skill

Extends and augments third-party module types by adding properties, methods, and interfaces with type safety.

module-augmentation
🎯avoid-repeated-params🎯Skill

Prevents parameter mix-ups by using named object parameters instead of positional arguments with same-type parameters.

avoid-repeated-params
🎯limit-any-type🎯Skill

Helps developers replace unsafe `any` types with precise TypeScript type definitions, improving type safety and code quality.

limit-any-type
🎯mirror-types🎯Skill

Mirrors external types locally to prevent tight coupling and isolate code from external type changes.

mirror-types
🎯noimplicitany-completion🎯Skill

Eliminates implicit `any` types during TypeScript migration, enforcing strict type safety and completing the adoption process.

noimplicitany-completion
🎯template-literal-types🎯Skill

Demonstrates advanced TypeScript template literal types for creating precise, composable type definitions with string manipulation.

template-literal-types
🎯avoid-anecdotal-types🎯Skill

Prevents using overly specific types derived from anecdotal examples, promoting more robust and flexible TypeScript type definitions.

avoid-anecdotal-types
🎯typescript-devdependencies🎯Skill

Manages TypeScript and @types packages as devDependencies to keep production builds lean and prevent version conflicts.

typescript-devdependencies