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}