Skip to content

Instantly share code, notes, and snippets.

@matheusmurta
Created May 5, 2018 10:33
Show Gist options
  • Save matheusmurta/f8766ea6b284bbf49e78038acf1d2e78 to your computer and use it in GitHub Desktop.
Save matheusmurta/f8766ea6b284bbf49e78038acf1d2e78 to your computer and use it in GitHub Desktop.
livecodetypescript
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;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="app.js"></script>
</script>
</head>
<body>
</body>
</html>
//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