FartLabs / fart

🌫 Program that generates type definitions in multiple languages.
https://fart.fart.tools
MIT License
1 stars 0 forks source link

Implemented the `depo` keyword #13

Closed EthanThatOneKid closed 3 years ago

EthanThatOneKid commented 3 years ago

Now that I have implemented the depo keyword, this is possible:

; From ./apple_service.fart

type Apple {
  weight*: number
}

type AppleRequest {
  filters: {
    minWeight: number
    maxWeight: number
  }
}

type AppleResponse {
  value: Apple
}

depo AppleService {
  pickBestApple: <AppleRequest, AppleResponse>
}
// To ./apple_service.ts

export interface Apple {
  weight: number;
}

export interface AppleRequest {
  filters?: {
    minWeight?: number;
    maxWeight?: number;
  }
}

export interface AppleResponse {
  value?: Apple;
}

export interface AppleService {
  pickBestApple: (input: AppleRequest) => AppleResponse;
}`;