File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,24 @@ let number: number = 6;
15
15
// number = "" // Type 'string' is not assignable to type 'number'.
16
16
console . log ( number ) ;
17
17
18
- let userID : number = 334455 ;
18
+ // ': dataType' is not required when we are directly declaring the value. It is redundant. TS is smart enough to figure it out itself.
19
+ let userID = 334455 ;
20
+ // userID = 4454.3
19
21
console . log ( userID ) ;
20
22
21
23
// Boolean
22
24
let isLoggedIn : boolean = false
23
25
26
+ // Any
27
+ // TypeScript also has a special type, any, that you can use whenever you don’t want a particular value to cause typechecking errors.
28
+ // You usually want to avoid this, though, because any isn’t type-checked. Use the compiler flag noImplicitAny to flag any implicit any as an error.
29
+
30
+ let hero ;
31
+
32
+ function getHero ( ) {
33
+ return "SpiderMan" ;
34
+ }
35
+
36
+ hero = getHero ( )
37
+
24
38
export { }
You can’t perform that action at this time.
0 commit comments