Skip to content

Instantly share code, notes, and snippets.

@IvsonEmidio
Last active May 1, 2022 22:42
Show Gist options
  • Save IvsonEmidio/b8c9765952cc77680e74490cfc3d2876 to your computer and use it in GitHub Desktop.
Save IvsonEmidio/b8c9765952cc77680e74490cfc3d2876 to your computer and use it in GitHub Desktop.
SOLID - OCP - CORRECT
import ICar from "./ICar";
class Diablo implements ICar {
readonly brand = "Lamborghini";
readonly color = "black";
public getMarketPrice(): Promise<number> {
return new Promise((resolve, reject) => {
let result = 200;
if (typeof result === "number") {
resolve(80);
}
reject(20);
});
}
}
class Soul implements ICar {
readonly brand = "Kia";
readonly color = "Red";
public getMarketPrice(): Promise<number> {
return new Promise((resolve, reject) => {
let result = 200;
if (typeof result === "number") {
resolve(350);
}
reject(20);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment