Typescript install: Difference between revisions
From wikinotes
(Created page with " = Install = <blockquote> <syntaxhighlight lang="bash"> npm install -g typescript </syntaxhighlight> </blockquote><!-- Install -->") |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
npm install -g typescript | npm install -g typescript | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="typescript"> | |||
// greet.ts | |||
function greeting(num: number, person: string) { | |||
return `hello ${num}x times, ${person}`; | |||
} | |||
console.log(greeting(0, "user")); | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
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'