async-state-type

Advise type-safe React/TypeScript patterns for asynchronous data fetching.

3|1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/ncaq/konoka --skill async-state-type
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: async-state-type
Source: https://github.com/ncaq/konoka/tree/main/plugins/web-tasuke/skills/async-state-type
Command: npx skills add https://github.com/ncaq/konoka --skill async-state-type

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Avoids contradictory state types for asynchronous data fetching in React/TypeScript, such as data being present while loading or error flags simultaneously; promotes type-safe patterns using Suspense or discriminated unions to ensure predictable rendering.

Core Features & Use Cases

  • Recommends Suspense-based data fetching to yield concrete data types during loading.
  • Provides a discriminated-union approach for non-Suspense scenarios.
  • Includes practical examples and guidance for code reviews and implementation.

Quick Start

Apply the Suspense pattern in your React components to ensure data types are definitive during loading.

Frequently Asked Questions about async-state-type

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent contradictory async state types in React and TypeScript?

Prevent contradictory async state types in React and TypeScript by applying type-safe patterns like Suspense or discriminated unions, ensuring data, loading, and error states are mutually exclusive and predictable.

What is the best way to model loading and error states for asynchronous data fetching?

Model asynchronous data fetching states using discriminated unions to enforce compile-time guarantees for loading, success, and error, or use Suspense to yield concrete data types during loading.

When should I use React Suspense instead of discriminated unions for async data?

Use React Suspense when you want to yield concrete data types during loading, simplifying component logic. Use discriminated unions for non-Suspense scenarios requiring manual state checks.

Why does my TypeScript async state allow data to be present while loading is true?

TypeScript async state allows data during loading due to contradictory state types. Fix this by adopting type-safe patterns like discriminated unions to strictly separate loading, success, and error states.

Does this approach work for UI components that fetch data asynchronously in React?

Yes, this approach works for UI components fetching data asynchronously in React, providing recommended patterns and practical examples to ensure type-safe rendering for all data states.