Re: reasons for learning typescript
@10
You learn the modern syntax and, if you need to run it on old browsers that don't support it, you put it through Babel or any number of "now it's old JS" tools. The modern JS stuff offers a lot of stuff. For example:
function makeRequest(callback) {
makeHttpRequest("foo.com").then((e, res) {
if (e) {
console.log("Error!");
} else {
console.log(res);
}
callback(e, res);
})
}
function main(_) { makeRequest(doSomethingFunction);
becomes:
async function makeRequest() {
try {
let res = await makeHttpRequest("foo.com");
return res;
} catch(e) {
copnsole.log(e);
throw;
}
}
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector