Typescript install: Difference between revisions

From wikinotes
 
Line 17: Line 17:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
tsc greet.ts // writes 'greet.js'
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'