Typescript functions: Difference between revisions
From wikinotes
(Created page with "= Type Annotations = <blockquote> <syntaxhighlight lang="typescript"> function warn(msg: string) { console.log(msg); } </syntaxhighlight> </blockquote><!-- Type Annotations -->") |
|||
Line 2: | Line 2: | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="typescript"> | <syntaxhighlight lang="typescript"> | ||
function | function toInt(msg: string): number { | ||
return parseInt(msg); | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Type Annotations --> | </blockquote><!-- Type Annotations --> |
Latest revision as of 03:11, 11 December 2022
Type Annotations
function toInt(msg: string): number { return parseInt(msg); }