Typescript -> TypeScript (english) (#35206)
This commit is contained in:
@ -60,7 +60,7 @@ You can see that `ng generate`expedites Angular’s [boilerplate code](https://e
|
||||
|
||||
#### ng build
|
||||
|
||||
The `ng serve` command runs the project using `lite-server` webserver installed with other dependencies during the the creation of project with `ng new`. If you want to serve your Angular web application with your own webserver like Apache or Nginx, then you will have to build all the source Typescript files with `ng build`.
|
||||
The `ng serve` command runs the project using `lite-server` webserver installed with other dependencies during the the creation of project with `ng new`. If you want to serve your Angular web application with your own webserver like Apache or Nginx, then you will have to build all the source TypeScript files with `ng build`.
|
||||
|
||||
`ng build` produces a development build with all source maps, JavaScript files, CSS and HTML files and puts it in the `[name-of-app] -> dist` directory. This directory contains the `index.html` file which is the entry point to the Angular application. The content of this folder can be directly put into the web root of any web server to deploy. You don't need `ng serve` anymore.
|
||||
|
||||
|
@ -4,7 +4,7 @@ title: Any Type
|
||||
|
||||
# Any Type
|
||||
|
||||
The Any type instructs Typescript to suspend type checking for the specified variables. Useful when working with dynamic content for which you don't know the type, and for transitioning your codebase from JavaScript to Typescript in pieces. You can use JavaScript's implicit typing with variables declared with a type of Any.
|
||||
The Any type instructs TypeScript to suspend type checking for the specified variables. Useful when working with dynamic content for which you don't know the type, and for transitioning your codebase from JavaScript to TypeScript in pieces. You can use JavaScript's implicit typing with variables declared with a type of Any.
|
||||
|
||||
Although the Any type can be helpful in specific circumstances, it should be used with caution, since it means we opt out of TypeScript's typechecking.
|
||||
|
||||
|
@ -20,7 +20,7 @@ let names: Array<string> = ['Javier', 'Emma', 'John', 'Sophia', 'Emma'];
|
||||
```
|
||||
|
||||
## Built-in methods
|
||||
In Typescript's Array type you can use some built-in functions. Each type has common and unique methods.
|
||||
In TypeScript's Array type you can use some built-in functions. Each type has common and unique methods.
|
||||
Below you can read about the most used methods of the Array type. In the example, we will use the array declaration from above.
|
||||
|
||||
### pop()
|
||||
|
@ -1,27 +1,27 @@
|
||||
---
|
||||
title: Getters & Setters
|
||||
---
|
||||
|
||||
# Getters & Setters
|
||||
|
||||
Typescript also supports `get` and `set` property. Get and Set Properties are actually called Accessors. Accessors of a property contains executable statements associated with getting (reading) or setting (writing) the property. The declarations can contain get accessor or set accessor or both.
|
||||
|
||||
```typescript
|
||||
class User {
|
||||
private _fullName: string = '';
|
||||
|
||||
get fullName() {
|
||||
return this._fullName;
|
||||
}
|
||||
|
||||
set fullName(name) {
|
||||
this._fullName = name;
|
||||
}
|
||||
}
|
||||
|
||||
let user = new User();
|
||||
|
||||
user.fullName = 'John Doe';
|
||||
|
||||
console.log(user.fullName);
|
||||
```
|
||||
---
|
||||
title: Getters & Setters
|
||||
---
|
||||
|
||||
# Getters & Setters
|
||||
|
||||
TypeScript also supports `get` and `set` property. Get and Set Properties are actually called Accessors. Accessors of a property contains executable statements associated with getting (reading) or setting (writing) the property. The declarations can contain get accessor or set accessor or both.
|
||||
|
||||
```typescript
|
||||
class User {
|
||||
private _fullName: string = '';
|
||||
|
||||
get fullName() {
|
||||
return this._fullName;
|
||||
}
|
||||
|
||||
set fullName(name) {
|
||||
this._fullName = name;
|
||||
}
|
||||
}
|
||||
|
||||
let user = new User();
|
||||
|
||||
user.fullName = 'John Doe';
|
||||
|
||||
console.log(user.fullName);
|
||||
```
|
||||
|
@ -18,7 +18,7 @@ let greeting: string = `Hello, ${firstName} ${lastName}, thank you for attending
|
||||
```
|
||||
|
||||
## Built-in methods
|
||||
In Typescript you can use some built-in functions for specific types. Each type has common and unique methods.
|
||||
In TypeScript you can use some built-in functions for specific types. Each type has common and unique methods.
|
||||
Below you can read about the most used common methods for the string type.
|
||||
|
||||
### split('separator', limit)
|
||||
|
Reference in New Issue
Block a user