Build type-safe applications with confidence using TypeScript's powerful type system. Learn generics, conditional types, mapped types, and utility types through practical examples.
スキルZIPをダウンロード
Claudeでアップロード
設定 → 機能 → スキル → スキルをアップロードへ移動
オンにして利用開始
テストする
「typescript-advanced-types」を使用しています。 Create a generic merge function that combines two objects and preserves their types
期待される結果:
function merge<T, U>(obj1: T, obj2: U): T & U { return { ...obj1, ...obj2 }; }
const result = merge({ name: 'John' }, { age: 30 });
// Type: { name: string } & { age: number }
// Usage: result.name (string), result.age (number)
「typescript-advanced-types」を使用しています。 Create a utility type that makes all nested properties readonly
期待される結果:
type DeepReadonly<T> = {
readonly [P in keyof T]: T[P] extends object
? T[P] extends Function ? T[P] : DeepReadonly<T[P]>
: T[P];
};
// Usage: All nested properties become immutable at compile time
セキュリティ監査
安全Static analyzer detected 76 patterns but all are false positives. The skill contains documentation-only content with TypeScript code examples in markdown format. No executable code, network calls, or security risks present. All detected patterns are from code snippets used for educational purposes.
品質スコア
作れるもの
Type-Safe Library Development
Build reusable libraries and frameworks with strong type guarantees that provide excellent developer experience.
Complex API Client Design
Create type-safe API clients with automatic inference of request parameters, response types, and error handling.
Enterprise Application Architecture
Implement robust type systems for large-scale applications with complex data models and state management.
これらのプロンプトを試す
Create a generic function that accepts any type and returns the same type. Show how TypeScript infers the type automatically and how to explicitly specify it.
Design a conditional type that checks if a type extends another type. Use it to create a type-level validation system for common data types like strings, numbers, and arrays.
Create a mapped type that transforms all properties of an API response type to be optional and readonly. Include key remapping to add getter methods.
Implement a complete type-safe event emitter using generics, conditional types, and template literal types. Support multiple event types with their specific payload types.
ベストプラクティス
- Use unknown instead of any to enforce type checking before operations
- Prefer interface for object shapes and type for unions and complex types
- Leverage TypeScript's type inference and avoid unnecessary type annotations
回避
- Overusing any type which defeats TypeScript's type safety guarantees
- Creating overly complex types that slow down compilation and reduce readability
- Ignoring strict null checks which can lead to runtime errors in production
よくある質問
What is the difference between interface and type in TypeScript?
When should I use generics versus union types?
How do conditional types work in TypeScript?
What are mapped types and when should I use them?
How can I test my TypeScript types?
What are template literal types used for?
開発者の詳細
作成者
sickn33ライセンス
MIT
リポジトリ
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/typescript-advanced-types参照
main
ファイル構成