all publishers

marius-townhouse

@marius-townhouse source repo

83 published skills

  1. ▌
    Use Readonly · marius-townhouse
    Use when passing arrays or objects to functions. Use when mutation bugs occur. Use when wanting to signal that data should not be modified.
    6 repo stars
  2. ▌
    Branded Types · marius-townhouse
    Use when primitive types need semantic distinction. Use when string or number types have different meanings. Use when you need nominal typing.
    6 repo stars
  3. ▌
    Dom Hierarchy · marius-townhouse
    Use when working with DOM APIs. Use when typing element references. Use when creating DOM utilities. Use when handling events. Use when manipulating the DOM.
    6 repo stars
  4. ▌
    Tagged Unions · marius-townhouse
    Use when modeling states or variants. Use when interface has union properties. Use when different states have different data requirements.
    6 repo stars
  5. ▌
    Type Coverage · marius-townhouse
    Use when measuring type safety. Use when any types creep in. Use when migrating from JavaScript.
    6 repo stars
  6. ▌
    Types As Sets · marius-townhouse
    Use when reasoning about type relationships. Use when confused by union or intersection types. Use when extends feels counterintuitive.
    6 repo stars
  7. ▌
    Allowjs Mixing · marius-townhouse
    Use when migrating JavaScript to TypeScript. Use when gradually adopting TypeScript. Use when working with mixed codebases. Use when converting large projects. Use when teams are learning TypeScript.
    6 repo stars
  8. ▌
    Evolving Types · marius-townhouse
    Use when types change as code executes. Use when arrays are built incrementally. Use when working with any[] that narrows.
    6 repo stars
  9. ▌
    Limit Any Type · marius-townhouse
    Use when tempted to use any type. Use when getting type errors that seem hard to fix. Use when migrating JavaScript to TypeScript.
    6 repo stars
  10. ▌
    Tsdoc Comments · marius-townhouse
    Use when documenting public APIs. Use when writing library code. Use when using JSDoc-style comments. Use when generating documentation. Use when explaining complex types.
    6 repo stars
  11. ▌
    Type Narrowing · marius-townhouse
    Use when working with union types. Use when handling nullable values. Use when TypeScript says a value might be undefined. Use when working with discriminated unions.
    6 repo stars
  12. ▌
    No Type In Docs · marius-townhouse
    Use when writing comments about types. Use when documenting function parameters. Use when naming variables.
    6 repo stars
  13. ▌
    Soundness Traps · marius-townhouse
    Use when types don't match runtime values. Use when TypeScript misses errors. Use when understanding type system limits.
    6 repo stars
  14. ▌
    Test Your Types · marius-townhouse
    Use when writing type declarations. Use when authoring libraries. Use when refactoring type utilities. Use when types and implementation are separate. Use when types contain complex logic.
    6 repo stars
  15. ▌
    Narrow Any Scope · marius-townhouse
    Use when any is unavoidable. Use when working with untyped libraries. Use when silencing specific type errors.
    6 repo stars
  16. ▌
    Tsconfig Options · marius-townhouse
    Use when setting up a TypeScript project. Use when confused by type checking behavior. Use when strict mode causes unexpected errors.
    6 repo stars
  17. ▌
    Type Value Space · marius-townhouse
    Use when symbols are ambiguous. Use when class or typeof behaves unexpectedly. Use when destructuring fails.
    6 repo stars
  18. ▌
    Record Types Sync · marius-townhouse
    Use when properties need synchronized configuration. Use when adding new properties requires updates elsewhere. Use when implementing optimization checks. Use when building property validators. Use when maintaining parallel data structures.
    6 repo stars
  19. ▌
    Structural Typing · marius-townhouse
    Use when surprised by TypeScript accepting unexpected values. Use when designing function parameters. Use when testing with mock objects.
    6 repo stars
  20. ▌
    Type Vs Interface · marius-townhouse
    Use when defining object types. Use when choosing between type and interface. Use when extending types.
    6 repo stars
  21. ▌
    Valid State Types · marius-townhouse
    Use when designing types that represent state. Use when types allow invalid combinations. Use when state has implicit dependencies between fields.
    6 repo stars
  22. ▌
    Callback This Type · marius-townhouse
    Use when callbacks use this. Use when API provides this context. Use when typing event handlers. Use when library sets this in callbacks. Use when documenting callback context.
    6 repo stars
  23. ▌
    Consistent Aliases · marius-townhouse
    Use when narrowing doesn't work as expected. Use when using variables for object properties. Use when refinements are lost.
    6 repo stars
  24. ▌
    Currying Inference · marius-townhouse
    Use when generic types aren't inferred. Use when builder patterns need better types. Use when creating new inference sites.
    6 repo stars
  25. ▌
    No Null In Aliases · marius-townhouse
    Use when defining type aliases. Use when null/undefined appears in type definitions. Use when types are confusing.
    6 repo stars
  26. ▌
    TS JS Relationship · marius-townhouse
    Use when confused about TypeScript vs JavaScript. Use when migrating JS to TS. Use when explaining TypeScript to newcomers.
    6 repo stars
  27. ▌
    Avoid Numeric Index · marius-townhouse
    Use when defining array-like types. Use when tempted to use number as index type. Use when understanding array keys.
    6 repo stars
  28. ▌
    Avoid Wrapper Types · marius-townhouse
    Use when typing primitives. Use when tempted to use String, Number, Boolean. Use when wrapper types appear in errors.
    6 repo stars
  29. ▌
    Export Public Types · marius-townhouse
    Use when publishing libraries. Use when types appear in public APIs. Use when users need to reference types. Use when building reusable components. Use when designing library interfaces.
    6 repo stars
  30. ▌
    Module Augmentation · marius-townhouse
    Use when extending third-party types. Use when adding properties to existing interfaces. Use when plugins extend core types. Use when declaration merging is needed. Use when augmenting global types.
    6 repo stars
  31. ▌
    Async Over Callbacks · marius-townhouse
    Use when writing asynchronous code. Use when tempted to use callbacks. Use when composing multiple async operations.
    6 repo stars
  32. ▌
    Code Gen Independent · marius-townhouse
    Use when confused about types at runtime. Use when trying to use instanceof with interfaces. Use when type errors don't prevent JavaScript output.
    6 repo stars
  33. ▌
    Compiler Performance · marius-townhouse
    Use when build times are slow. Use when optimizing TypeScript projects. Use when configuring project references. Use when dealing with large codebases. Use when improving IDE responsiveness.
    6 repo stars
  34. ▌
    Editor Interrogation · marius-townhouse
    Use when debugging type inference. Use when types behave unexpectedly. Use when learning unfamiliar code.
    6 repo stars
  35. ▌
    Precise Any Variants · marius-townhouse
    Use when forced to use any. Use when any is too broad. Use when function types need any.
    6 repo stars
  36. ▌
    Precise String Types · marius-townhouse
    Use when working with string-typed properties. Use when string values have a limited set of options. Use when keyof could provide better type safety.
    6 repo stars
  37. ▌
    Three Versions Types · marius-townhouse
    Use when publishing type declarations. Use when dealing with version conflicts. Use when libraries have types. Use when managing @types packages. Use when debugging type mismatches.
    6 repo stars
  38. ▌
    Variadic Tuple Types · marius-townhouse
    Use when functions accept variable arguments. Use when typing rest parameters with specific constraints. Use when building generic function compositions. Use when preserving tuple length through transformations. Use when working with typed function pipelines.
    6 repo stars
  39. ▌
    Avoid Anecdotal Types · marius-townhouse
    Use when creating types from example data. Use when types don't match all cases. Use when API responses vary.
    6 repo stars
  40. ▌
    Avoid Repeated Params · marius-townhouse
    Use when functions have multiple parameters of same type. Use when parameter order is easy to confuse. Use when designing function signatures.
    6 repo stars
  41. ▌
    Domain Language Types · marius-townhouse
    Use when naming types. Use when types describe structure not meaning. Use when domain experts won't understand type names.
    6 repo stars
  42. ▌
    Generics As Functions · marius-townhouse
    Use when defining generic types or functions. Use when constraining type parameters. Use when writing type-level code. Use when documenting generic types.
    6 repo stars
  43. ▌
    Source Maps Debugging · marius-townhouse
    Use when debugging TypeScript in browser. Use when setting up build tools. Use when stack traces show compiled code. Use when breakpoints don't work. Use when deploying to production.
    6 repo stars
  44. ▌
    Context Type Inference · marius-townhouse
    Use when extracting values causes type errors. Use when callback types are wrong. Use when const assertions are needed.
    6 repo stars
  45. ▌
    Hide Unsafe Assertions · marius-townhouse
    Use when type assertions are necessary. Use when function implementations need any. Use when hiding unsafe code.
    6 repo stars
  46. ▌
    Iterate Objects Safely · marius-townhouse
    Use when iterating over object keys and values. Use when for...in loops produce type errors. Use when Object.entries returns any types. Use when dealing with prototype pollution concerns. Use when considering Map vs object.
    6 repo stars
  47. ▌
    Push Null To Perimeter · marius-townhouse
    Use when designing data structures with nullable values. Use when null checking is scattered throughout code. Use when related values have implicit null relationships.
    6 repo stars
  48. ▌
    Template Literal Types · marius-townhouse
    Use when modeling structured string patterns. Use when parsing DSLs like CSS selectors. Use when transforming string types. Use when validating string formats. Use when combining with mapped types.
    6 repo stars
  49. ▌
    Type Display Attention · marius-townhouse
    Use when complex types display poorly in IDE. Use when users see ugly type expansions. Use when debugging type issues. Use when building public APIs. Use when types become deeply nested.
    6 repo stars
  50. ▌
    Distinct Special Values · marius-townhouse
    Use when tempted to use -1 or "" as special values. Use when indexOf returns -1. Use when special cases need representation.
    6 repo stars
  51. ▌
    Exclusive Or Properties · marius-townhouse
    Use when exactly one of several properties should be present. Use when modeling mutually exclusive options. Use when building component props with alternative configurations. Use when designing API parameters that have variants.
    6 repo stars
  52. ▌
    Exhaustiveness Checking · marius-townhouse
    Use when handling tagged unions. Use when adding new cases to discriminated unions. Use when switch statements must cover all cases.
    6 repo stars
  53. ▌
    Prefer Type Annotations · marius-townhouse
    Use when assigning values to variables with types. Use when tempted to use type assertions. Use when TypeScript flags type errors you want to silence.
    6 repo stars
  54. ▌
    Prefer Unknown Over Any · marius-townhouse
    Use when receiving values of unknown type. Use when parsing JSON. Use when working with external data. Use instead of any.
    6 repo stars
  55. ▌
    Tail Recursive Generics · marius-townhouse
    Use when getting "Type instantiation is excessively deep" errors. Use when writing recursive generic types. Use when processing large or deep type structures. Use when building type-level loops.
    6 repo stars
  56. ▌
    Write Modern Javascript · marius-townhouse
    Use when writing TypeScript that compiles to JavaScript. Use when configuring tsconfig target. Use when choosing language features. Use when supporting older browsers. Use when optimizing bundle size.
    6 repo stars
  57. ▌
    Excess Property Checking · marius-townhouse
    Use when assigning object literals to typed variables. Use when confused by "unknown property" errors. Use when extra properties are flagged on object literals but not variables.
    6 repo stars
  58. ▌
    Noimplicitany Completion · marius-townhouse
    Use when finishing TypeScript migration. Use when enabling strict mode. Use when finalizing tsconfig. Use when ensuring type safety. Use when completing adoption.
    6 repo stars
  59. ▌
    Type Checking Vs Testing · marius-townhouse
    Use when deciding between types and tests. Use when catching logic errors. Use when testing edge cases. Use when building test suites. Use when validating assumptions.
    6 repo stars
  60. ▌
    Understand Type Widening · marius-townhouse
    Use when confused why TypeScript infers general types. Use when const vs let gives different types. Use when literals become string or number.
    6 repo stars
  61. ▌
    Different Variables Types · marius-townhouse
    Use when tempted to reuse variables. Use when variable changes type. Use when using union types for multiple purposes.
    6 repo stars
  62. ▌
    Function Type Expressions · marius-townhouse
    Use when writing multiple functions with same signature. Use when implementing callbacks. Use when matching existing function types.
    6 repo stars
  63. ▌
    Imprecise Over Inaccurate · marius-townhouse
    Use when types become too complex. Use when precision causes false positives. Use when accuracy is uncertain.
    6 repo stars
  64. ▌
    Limit Optional Properties · marius-townhouse
    Use when adding optional properties. Use when types have many optional fields. Use when considering required vs optional.
    6 repo stars
  65. ▌
    TS Check Jsdoc Experiment · marius-townhouse
    Use when experimenting with TypeScript. Use when migrating JavaScript gradually. Use when adding types to JS files. Use when teams are learning TypeScript. Use when validating JavaScript with types.
    6 repo stars
  66. ▌
    Type Safe Monkey Patching · marius-townhouse
    Use when adding properties to window, document, or DOM elements. Use when extending built-in objects at runtime. Use when working with jQuery or D3 globals. Use when migrating JavaScript that uses global variables.
    6 repo stars
  67. ▌
    Accurate Environment Model · marius-townhouse
    Use when defining global types. Use when augmenting window. Use when typing environment variables. Use when working with build-time constants. Use when configuring type definitions.
    6 repo stars
  68. ▌
    Codegen Over Complex Types · marius-townhouse
    Use when types become extremely complex. Use when types mirror external schemas. Use when maintaining type-to-schema mappings. Use when types require extensive type-level logic. Use when types drift from data sources.
    6 repo stars
  69. ▌
    Control Union Distribution · marius-townhouse
    Use when conditional types behave unexpectedly with unions. Use when boolean or never types cause surprises. Use when needing to prevent distribution over unions. Use when recursive generic types don't distribute.
    6 repo stars
  70. ▌
    Create Objects All At Once · marius-townhouse
    Use when building objects incrementally. Use when adding properties after creation. Use when TypeScript errors on dynamic object construction.
    6 repo stars
  71. ▌
    Module By Module Migration · marius-townhouse
    Use when migrating large codebases. Use when converting JavaScript to TypeScript. Use when managing dependencies. Use when planning migration order. Use when teams are adopting TypeScript.
    6 repo stars
  72. ▌
    Typescript Devdependencies · marius-townhouse
    Use when setting up TypeScript projects. Use when installing @types packages. Use when configuring package.json. Use when publishing libraries. Use when managing dependencies.
    6 repo stars
  73. ▌
    Avoid Inferable Annotations · marius-townhouse
    Use when writing type annotations on variables. Use when TypeScript can infer the type. Use when code feels cluttered with types.
    6 repo stars
  74. ▌
    Functional Constructs Types · marius-townhouse
    Use when building arrays in loops. Use when types don't flow through code. Use when considering map/filter/reduce.
    6 repo stars
  75. ▌
    Runtime Type Reconstruction · marius-townhouse
    Use when validating data at runtime. Use when parsing JSON. Use when types need runtime checks. Use when using io-ts or zod. Use when building validation schemas.
    6 repo stars
  76. ▌
    Index Signature Alternatives · marius-townhouse
    Use when defining object types with dynamic keys. Use when tempted to use index signatures. Use when parsing CSV or JSON data.
    6 repo stars
  77. ▌
    Liberal Accept Strict Return · marius-townhouse
    Use when designing function signatures. Use when creating APIs. Use when parameters have optional fields but return types feel too broad.
    6 repo stars
  78. ▌
    Avoid Unnecessary Type Params · marius-townhouse
    Use when writing generic functions or types. Use when reviewing type signatures. Use when a type parameter only appears once. Use when tempted to add generics for "flexibility".
    6 repo stars
  79. ▌
    Conditional Types Over Overloads · marius-townhouse
    Use when typing functions with multiple return types. Use when function behavior depends on input type. Use when dealing with union type inputs. Use when considering function overloads.
    6 repo stars
  80. ▌
    Ecmascript Over Typescript Features · marius-townhouse
    Use when choosing between TypeScript and ECMAScript features. Use when writing portable code. Use when considering enum or namespace. Use when targeting multiple JavaScript environments. Use when writing library code.
    6 repo stars
  81. ▌
    Dry Types · marius-townhouse
    Use when duplicating type definitions. Use when interfaces share common fields. Use when types can be derived from other types.
    6 repo stars
  82. ▌
    Unify Types · marius-townhouse
    Use when similar types have minor differences. Use when union types become complex. Use when choosing between modeling differences.
    6 repo stars
  83. ▌
    Mirror Types · marius-townhouse
    Use when depending on external types. Use when avoiding tight coupling. Use when external types might change. Use when building adapters. Use when types are only used internally.
    6 repo stars