TypeScript
by Laura Kishimoto
HTML
<div id="app"></div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
text-align: center;
}
TypeScript
interface Conveyor {
length: number,
speed: number,
duration: number
}
interface Product {
name: string,
components: Array<string>
}
const conveyor : Conveyor = {
length: 3,
speed: 1000,
duration: 100
}
const products : array<Product> = [
"c": {
components: [
"a", "b"
],
assemblyTime: 4
}
]
function produce(conveyor) {
return `${conveyor.length} | ${conveyor.speed}`;
}
document.querySelector("#app").innerHTML = produce(conveyor);
/* TODOs
* place random items
* basic tests
* error handling
* check if user has all parts
* next step
* run again?
* count items that fall off
* populate new items
*/