Skip to main content
DevTools24

GraphQL إلى TypeScript

تحويل مخططات GraphQL إلى أنواع TypeScript. يدعم الأنواع والمدخلات والتعدادات والقيم العددية.

Supported GraphQL constructs:
  • type → interface/type
  • input → interface/type with optional fields
  • enum → TypeScript enum
  • scalar → type alias
  • • Lists [Type] → Type[]
  • • Non-null ! modifier

Type-Safe GraphQL - التفاصيل التقنية

Generating TypeScript types from GraphQL schemas ensures type safety across your client and server. The GraphQL type system maps naturally to TypeScript, with nullable fields becoming optional properties.

بديل سطر الأوامر

// GraphQL\ntype User {\n  id: ID!\n  name: String\n}\n\n// TypeScript\ninterface User {\n  id: string;\n  name: Maybe<string>;\n}

المرجع

عرض المواصفات الرسمية