Typescript install: Difference between revisions
From wikinotes
No edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
// greet.ts | // greet.ts | ||
function greeting( | function greeting(num: number, person: string) { | ||
return | return `hello ${num}x times, ${person}`; | ||
} | } | ||
Line 17: | Line 17: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
tsc greet.ts | tsc greet.ts # writes 'greet.js' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Install --> | </blockquote><!-- Install --> |
Latest revision as of 04:31, 17 December 2022
Install
npm install -g typescript// greet.ts function greeting(num: number, person: string) { return `hello ${num}x times, ${person}`; } console.log(greeting(0, "user"));tsc greet.ts # writes 'greet.js'