Created
May 5, 2018 10:33
-
-
Save matheusmurta/f8766ea6b284bbf49e78038acf1d2e78 to your computer and use it in GitHub Desktop.
livecodetypescript
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
class Produto { | |
codigo : string; | |
descricao : string; | |
preco : number; | |
constructor(_codigo : string, _descricao : string, _preco : number) { | |
this.codigo = _codigo; | |
this.descricao = _descricao; | |
this.preco = _preco; | |
} | |
getDados() { | |
return "Produto " + this.codigo + ": " + this.descricao + " - R$ " + this.preco; | |
} | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<script src="app.js"></script> | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
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
//npm install -g typescript | |
//verificar a versão | |
tsc -v | |
// run ts | |
tsc | |
//criar arquivo de configuracao | |
tsc meuscript.js --init | |
//rodar usando node.js | |
node meuscript.js | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment