This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myHouse = new House( | |
House.WithRooms(5), | |
House.WithFloors(2), | |
House.WithMaterial('wood'), | |
await House.WithExternalData(), | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Material = 'wood' | 'brick' | 'steel' | |
type HouseOption = (h: House) => void | |
class House { | |
private rooms: number | |
private floors: number | |
private material: Material | |
private externalData: any |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Material = 'wood' | 'brick' | 'steel' | |
interface HouseOptions { | |
rooms: number | |
floors: number | |
material: Material | |
bathrooms: number | |
squareFootage: number | |
address: string | |
constructionDate?: Date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Material = 'wood' | 'brick' | 'steel' | |
class House { | |
private rooms: number | |
private floors: number | |
private material: Material | |
private bathrooms: number | |
private squareFootage: number | |
private address: string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Material = 'wood' | 'brick' | 'steel' | |
type HouseOption = (h: House) => void | |
class House { | |
private rooms: number | |
private floors: number | |
private material: Material | |
constructor(...options: HouseOption[]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Material = 'wood' | 'brick' | 'steel' | |
interface HouseOptions { | |
rooms: number | |
floors: number | |
material: Material | |
} | |
class House { | |
private rooms: number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Material = 'wood' | 'brick' | 'steel' | |
class House { | |
private rooms: number | |
private floors: number | |
private material: Material | |
constructor(rooms: number, floors: number, material: Material) { | |
this.rooms = rooms | |
this.floors = floors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: help | |
help: | |
@echo '' | |
@echo 'Makefile' | |
@echo '' | |
@echo 'Usage' | |
@echo '' | |
@echo ' make run Run the project' | |
@echo ' make test Run the unit tests' | |
@echo ' make cover Run the unit tests and enforce coverage' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package foo_test | |
import ( | |
"errors" | |
"testing" | |
"interfaces/foo" | |
) | |
type MockClient struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package foo | |
import ( | |
"errors" | |
) | |
type IExternalClient interface { | |
GetData() (string, error) | |
} |
NewerOlder