TypeScript interface for housing location data - reusable across Angular applications
npm install @sbogde/housing-location-interface

TypeScript interface for housing location data - reusable across Angular and TypeScript applications.
A simple, well-typed interface for representing housing/real estate property data. Perfect for Angular apps, React apps, or any TypeScript project dealing with property listings.
``bash`
npm install @sbogde/housing-location-interface
`typescript
import { HousingLocation } from '@sbogde/housing-location-interface';
const property: HousingLocation = {
id: 1,
name: 'Acme Fresh Start Housing',
city: 'Chicago',
state: 'IL',
photo: '/assets/property.jpg',
availableUnits: 4,
wifi: true,
laundry: true
};
`
`typescript
import { isHousingLocation } from '@sbogde/housing-location-interface';
const data = fetchDataFromAPI();
if (isHousingLocation(data)) {
// TypeScript knows data is a valid HousingLocation
console.log(data.city);
}
`
`typescript
import { createMockHousingLocation } from '@sbogde/housing-location-interface';
const mockProperty = createMockHousingLocation({
name: 'Test Property',
city: 'Test City'
});
// Use in your tests
expect(component.property).toEqual(mockProperty);
`
`typescript`
interface HousingLocation {
id: number; // Unique identifier
name: string; // Property name
city: string; // City location
state: string; // State/province
photo: string; // Photo URL or path
availableUnits: number; // Number of available units
wifi: boolean; // WiFi availability
laundry: boolean; // Laundry facilities
}
- HousingLocation - Main TypeScript interface
- isHousingLocation(obj: any): obj is HousingLocation - Type guard function
- createMockHousingLocation(overrides?: Partial
- Angular property listing applications
- Real estate web applications
- TypeScript projects needing property type definitions
- Testing and mock data generation
- Ensuring type safety across multiple projects
This package was created as part of the ng-house-hunters tutorial project.
MIT © Sorin Bogde
Issues and pull requests are welcome!
For questions or feedback, open an issue on GitHub.