type Direction = "left" | "right" | "up" | "down";
funtction move(direction:Direction){
console.log(direction)
}
move('right')
type tileiSize = 8 | 16 | 32;
const TileSize 16;
type SuccessState = {
response : {
body: string:
}
}
type FailState = {
reson: string;
}
type LoginState = SucessState | FailState;
function login(id: string, pw:string): Promise<LoginState> {
return {
response : {
body: string:
}
}
}
function printLoginState(state : LoginState){
if('response' in state){
console.log(state.response.body)
}else{
console.log(state.reason);
}
}