โ† All skills
Tencent SkillHub ยท Developer Tools

TypeScript

Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.

skill openclawclawhub Free
0 Downloads
0 Stars
0 Installs
0 Score
High Signal

Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.

โฌ‡ 0 downloads โ˜… 0 stars Unverified but indexed

Install for OpenClaw

Quick setup
  1. Download the package from Yavira.
  2. Extract the archive and review SKILL.md first.
  3. Import or place the package into your OpenClaw setup.

Requirements

Target platform
OpenClaw
Install method
Manual import
Extraction
Extract archive
Prerequisites
OpenClaw
Primary doc
SKILL.md

Package facts

Download mode
Yavira redirect
Package format
ZIP package
Source platform
Tencent SkillHub
What's included
SKILL.md, declarations.md, generics.md, migration.md, utility-types.md

Validation

  • Use the Yavira download entry.
  • Review SKILL.md after the package is downloaded.
  • Confirm the extracted package contains the expected setup assets.

Install with your agent

Agent handoff

Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.

  1. Download the package from Yavira.
  2. Extract it into a folder your agent can access.
  3. Paste one of the prompts below and point your agent at the extracted folder.
New install

I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.

Upgrade existing

I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.

Trust & source

Release facts

Source
Tencent SkillHub
Verification
Indexed source record
Version
1.0.2

Documentation

ClawHub primary doc Primary doc: SKILL.md 10 sections Open source page

When to Use

User needs TypeScript expertise โ€” from basic typing to advanced generics. Agent handles type narrowing, inference, discriminated unions, and strict mode patterns.

Quick Reference

TopicFileGeneric patternsgenerics.mdUtility typesutility-types.mdDeclaration filesdeclarations.mdMigration from JSmigration.md

Stop Using any

unknown forces you to narrow before use โ€” any silently breaks type safety API responses: type them or use unknown, never any When you don't know the type, that's unknown, not any

Narrowing Failures

filter(Boolean) doesn't narrow โ€” use .filter((x): x is T => Boolean(x)) Object.keys(obj) returns string[], not keyof typeof obj โ€” intentional, objects can have extra keys Array.isArray() narrows to any[] โ€” may need assertion for element type in operator narrows but only if property is in exactly one branch of union

Literal Type Traps

let x = "hello" is string โ€” use const or as const for literal type Object properties widen: { status: "ok" } has status: string โ€” use as const or type annotation Function return types widen โ€” annotate explicitly for literal returns

Inference Limits

Callbacks lose inference in some array methods โ€” annotate parameter when TS guesses wrong Generic functions need usage to infer โ€” fn<T>() can't infer, pass a value or annotate Nested generics often fail โ€” break into steps with explicit types

Discriminated Unions

Add a literal type or kind field to each variant โ€” enables exhaustive switch Exhaustive check: default: const _never: never = x โ€” compile error if case missed Don't mix discriminated with optional properties โ€” breaks narrowing

satisfies vs Type Annotation

const x: Type = val widens to Type โ€” loses literal info const x = val satisfies Type keeps literal, checks compatibility โ€” prefer for config objects

Strict Null Handling

Optional chaining ?. returns undefined, not null โ€” matters for APIs expecting null ?? only catches null/undefined โ€” || catches all falsy including 0 and "" Non-null ! should be last resort โ€” prefer narrowing or early return

Module Boundaries

import type for type-only imports โ€” stripped at runtime, avoids bundler issues Re-exporting types: export type { X } โ€” prevents accidental runtime dependency .d.ts augmentation: use declare module with exact module path

Category context

Code helpers, APIs, CLIs, browser automation, testing, and developer operations.

Source: Tencent SkillHub

Largest current source with strong distribution and engagement signals.

Package contents

Included in package
5 Docs
  • SKILL.md Primary doc
  • declarations.md Docs
  • generics.md Docs
  • migration.md Docs
  • utility-types.md Docs