Write a simple example

Write a simple example

Let’s write a Hello World program. In src, create the file main.ts:

1
2
3
4
function hello(compiler: string) {
  console.log(`Hello from ${compiler}`);
}
hello("TypeScript");

In the project root, proj, create the file tsconfig.json:

1
2
3
4
5
6
7
8
9
{
  "files": [
    "src/main.ts"
  ],
  "compilerOptions": {
    "noImplicitAny": true,
    "target": "es5"
  }
}
doc_TypeScript
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.