Skip to content

Instantly share code, notes, and snippets.

@phoenix2307
Created June 26, 2022 17:18
Show Gist options
  • Save phoenix2307/cd5d75b2606b279a0e01aff1acb77659 to your computer and use it in GitHub Desktop.
Save phoenix2307/cd5d75b2606b279a0e01aff1acb77659 to your computer and use it in GitHub Desktop.
city
type StreetType = {
title: string
}
type AddressType = {
number: number
street: StreetType
}
export type HouseType = {
buildedAt: number
repaired: boolean
address: AddressType
}
type AddressGoverBuildType = {
street: StreetType
}
export type GovernmentBuildingsType = {
type: string
budget: number
staffCount: number
address: AddressGoverBuildType
}
export type CityType = {
title: string
houses: Array<HouseType>
governmentBuildings: Array<GovernmentBuildingsType>
citizensNumber: number
}
const city: CityType = {
title: 'New York',
houses: [
{
buildedAt: 2012,
repaired: false,
address: {
number: 100,
street: {
title: 'White street'
}
}
},
{
buildedAt: 2008,
repaired: false,
address: {
number: 100,
street: {
title: 'Happy street'
}
}
},
{
buildedAt: 2020,
repaired: false,
address: {
number: 101,
street: {
title: 'Happy street'
}
}
}
],
governmentBuildings: [
{
type: 'HOSPITAL',
budget: 200000,
staffCount: 200,
address: {
street: {
title: 'Central Park'
}
}
},
{
type: 'FIRE-STATION',
budget: 500000,
staffCount: 1000,
address: {
street: {
title: 'South Park'
}
}
}
],
citizensNumber: 1000000
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment