Adding content to 102-install-configure

pull/3423/head
syedmouaazfarrukh 2 years ago committed by Kamran Ahmed
parent 754a91acef
commit 07f001f8be
  1. 31
      src/roadmaps/typescript/content/100-typescript/102-install-configure/100-tsconfig-json.md
  2. 31
      src/roadmaps/typescript/content/100-typescript/102-install-configure/101-compiler-options.md
  3. 57
      src/roadmaps/typescript/content/100-typescript/102-install-configure/index.md

@ -1 +1,30 @@
# Tsconfig json
# Tsconfig JSON
tsconfig.json is a configuration file in TypeScript that specifies the compiler options for building your project. It helps the TypeScript compiler understand the structure of your project and how it should be compiled to JavaScript. Some common options include:
- **target**: the version of JavaScript to compile to.
- **module**: the module system to use.
- **stric**": enables/disables strict type checking.
- **outDir**: the directory to output the compiled JavaScript files.
- **rootDir**: the root directory of the TypeScript files.
- **exclude**: an array of file/directory patterns to exclude from the compilation.
Example:
```
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"outDir": "./dist",
"rootDir": "./src",
"exclude": ["node_modules"]
}
}
```
Learn more from the following links:
- [What is a tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#handbook-content)
- [TypeScript Projects: What is a tsconfig.json?](https://www.youtube.com/watch?v=sLylejlr6lA)

@ -1 +1,30 @@
# Compiler options
# Compiler Options
Compiler options in TypeScript are a set of configuration settings that control how the TypeScript compiler compiles your code. Here are some commonly used compiler options with examples:
1. target
2. module
3. strict
4. outDir
5. rootDir
6. exclude
Have a look at the following example tsconfig.json:
```
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"outDir": "./dist",
"rootDir": "./src",
"exclude": ["node_modules"]
}
}
```
Learn more from the following links:
- [Compiler Options](https://www.typescriptlang.org/docs/handbook/compiler-options.html#compiler-options)
- [TypeScript Compiler Options](https://www.youtube.com/watch?v=I1ZFsPK0Q-Y&vl=en)

@ -1 +1,56 @@
# Install configure
# Install Configure
To install and configure TypeScript in your project, you need to perform the following steps:
- Install TypeScript globally on your machine using npm (Node Package Manager):
```
npm install -g typescript
```
- Initialize npm in your project directory by running the following command:
```
npm init
```
- Install TypeScript as a project dependency by running the following command:
```
npm install --save-dev typescript
```
- Create a tsconfig.json file in your project directory to specify the compiler options for building your project. For example:
```
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"outDir": "./dist",
"rootDir": "./src",
"exclude": ["node_modules"]
}
}
```
- Compile your TypeScript code using the following command:
```
tsc
```
Note: You can also compile individual TypeScript files by specifying the file name after the tsc command.For example:
```
tsc index.ts
```
And you're all set! You can now start writing TypeScript code in your project.
Learn more from the following links:
- [How To Configure TypeScript](https://www.youtube.com/watch?v=SEnAS_ooHeA)
- [Installing TypeScript](https://www.typescriptlang.org/download)
Loading…
Cancel
Save