├── 004_installing_typescript.js ├── 004_installing_typescript.ts ├── 005_typescript_config.js ├── 005_typescript_config.js.map ├── 005_typescript_config.ts ├── 006_5_string_interpolation.js ├── 006_5_string_interpolation.js.map ├── 006_5_string_interpolation.ts ├── 006_variables.js ├── 006_variables.js.map ├── 006_variables.ts ├── 007_types.ts ├── 008_type_alias.js ├── 008_type_alias.js.map ├── 008_type_alias.ts ├── 009_union_types.js ├── 009_union_types.js.map ├── 009_union_types.ts ├── 010_arithmetic_operators.js ├── 010_arithmetic_operators.js.map ├── 010_arithmetic_operators.ts ├── 011_conditionals.js ├── 011_conditionals.js.map ├── 011_conditionals.ts ├── 012_conditional_operators.js ├── 012_conditional_operators.js.map ├── 012_conditional_operators.ts ├── 013_compound_conditionals.js ├── 013_compound_conditionals.js.map ├── 013_compound_conditionals.ts ├── 014_loops.js ├── 014_loops.js.map ├── 014_loops.ts ├── 015_functions.js ├── 015_functions.js.map ├── 015_functions.ts ├── 016_5_arrow_functions.js ├── 016_5_arrow_functions.js.map ├── 016_5_arrow_functions.ts ├── 016_function_args.js ├── 016_function_args.js.map ├── 016_function_args.ts ├── 017_function_declarations_vs_expressions.js ├── 017_function_declarations_vs_expressions.js.map ├── 017_function_declarations_vs_expressions.ts ├── 018_5_immediatel_invoked_arguments.js ├── 018_5_immediatel_invoked_arguments.js.map ├── 018_5_immediatel_invoked_arguments.ts ├── 018_immediately_invoked_functions.js ├── 018_immediately_invoked_functions.js.map ├── 018_immediately_invoked_functions.ts ├── 019_closure_introduction.js ├── 019_closure_introduction.js.map ├── 019_closure_introduction.ts ├── 020_classes.js ├── 020_classes.js.map ├── 020_classes.ts ├── 021_inheritance.js ├── 021_inheritance.js.map ├── 021_inheritance.ts ├── 022_objects.js ├── 022_objects.js.map ├── 022_objects.ts ├── 023_interfaces.js ├── 023_interfaces.js.map ├── 023_interfaces.ts ├── 024_interface_functions.js ├── 024_interface_functions.js.map ├── 024_interface_functions.ts ├── 025_interface_classes.js ├── 025_interface_classes.js.map ├── 025_interface_classes.ts ├── 026_namespaces.js ├── 026_namespaces.js.map ├── 026_namespaces.ts ├── 027_this.js ├── 027_this.js.map ├── 027_this.ts ├── 028_higher_order_functions_callbacks.js ├── 028_higher_order_functions_callbacks.js.map ├── 028_higher_order_functions_callbacks.ts ├── 029_promises.js ├── 029_promises.js.map ├── 029_promises.ts ├── 030_decorator_introduction.js ├── 030_decorator_introduction.js.map ├── 030_decorator_introduction.ts ├── 031_class_decorator.js ├── 031_class_decorator.js.map ├── 031_class_decorator.ts ├── 032_method_decorator.js ├── 032_method_decorator.js.map ├── 032_method_decorator.ts ├── 033_decorator_example_angular.ts ├── README.md ├── tsconfig.json ├── typings.json └── typings ├── globals ├── es6-collections │ ├── index.d.ts │ └── typings.json ├── es6-promise │ ├── index.d.ts │ └── typings.json └── es6-shim │ ├── index.d.ts │ └── typings.json └── index.d.ts /004_installing_typescript.js: -------------------------------------------------------------------------------- 1 | var HelloAngularComponent = (function () { 2 | function HelloAngularComponent() { 3 | this.greeting = 'Hello TypeScript'; 4 | } 5 | return HelloAngularComponent; 6 | }()); 7 | -------------------------------------------------------------------------------- /004_installing_typescript.ts: -------------------------------------------------------------------------------- 1 | class HelloAngularComponent { 2 | greeting: string; 3 | constructor() { 4 | this.greeting = 'Hello TypeScript'; 5 | } 6 | } -------------------------------------------------------------------------------- /005_typescript_config.js: -------------------------------------------------------------------------------- 1 | function hey_there() { 2 | console.log("Hi from typescript"); 3 | } 4 | hey_there(); 5 | //# sourceMappingURL=005_typescript_config.js.map -------------------------------------------------------------------------------- /005_typescript_config.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"005_typescript_config.js","sourceRoot":"","sources":["005_typescript_config.ts"],"names":[],"mappings":"AAAA;IACC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,EAAE,CAAC"} -------------------------------------------------------------------------------- /005_typescript_config.ts: -------------------------------------------------------------------------------- 1 | function hey_there() { 2 | console.log("Hi from typescript"); 3 | } 4 | 5 | hey_there(); -------------------------------------------------------------------------------- /006_5_string_interpolation.js: -------------------------------------------------------------------------------- 1 | var msg = "Jordan"; 2 | console.log("A long message to " + msg + " filled with text"); 3 | console.log("A long message to " + msg + " filled with text"); 4 | //# sourceMappingURL=006_5_string_interpolation.js.map -------------------------------------------------------------------------------- /006_5_string_interpolation.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"006_5_string_interpolation.js","sourceRoot":"","sources":["006_5_string_interpolation.ts"],"names":[],"mappings":"AAAA,IAAI,GAAG,GAAY,QAAQ,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,GAAG,GAAG,mBAAmB,CAAC,CAAC;AAC9D,OAAO,CAAC,GAAG,CAAC,uBAAqB,GAAG,sBAAmB,CAAC,CAAC"} -------------------------------------------------------------------------------- /006_5_string_interpolation.ts: -------------------------------------------------------------------------------- 1 | var msg : string = "Jordan"; 2 | console.log("A long message to " + msg + " filled with text"); 3 | console.log(`A long message to ${msg} filled with text`); -------------------------------------------------------------------------------- /006_variables.js: -------------------------------------------------------------------------------- 1 | // var fullName : string = "Jordan Hudgens"; 2 | // let paidAccount : boolean = true; 3 | // const versionNumber : number = 1.3; 4 | // fullName = "Tiffany Hudgens"; 5 | // paidAccount = false; 6 | // console.log(fullName); 7 | // console.log(paidAccount); 8 | // console.log(versionNumber); 9 | function printName(f, l) { 10 | var greeting = "Hi there, "; 11 | console.log(greeting + f + " " + l); 12 | var greeting = "Hey there, "; 13 | console.log(greeting + f + " " + l); 14 | } 15 | printName("Jordan", "Hudgens"); 16 | //# sourceMappingURL=006_variables.js.map -------------------------------------------------------------------------------- /006_variables.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"006_variables.js","sourceRoot":"","sources":["006_variables.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,oCAAoC;AACpC,sCAAsC;AAEtC,gCAAgC;AAChC,uBAAuB;AAEvB,yBAAyB;AACzB,4BAA4B;AAC5B,8BAA8B;AAE9B,mBAAmB,CAAC,EAAE,CAAC;IACtB,IAAI,QAAQ,GAAY,YAAY,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;IAEpC,IAAI,QAAQ,GAAY,aAAa,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC"} -------------------------------------------------------------------------------- /006_variables.ts: -------------------------------------------------------------------------------- 1 | // var fullName : string = "Jordan Hudgens"; 2 | // let paidAccount : boolean = true; 3 | // const versionNumber : number = 1.3; 4 | 5 | // fullName = "Tiffany Hudgens"; 6 | // paidAccount = false; 7 | 8 | // console.log(fullName); 9 | // console.log(paidAccount); 10 | // console.log(versionNumber); 11 | 12 | function printName(f, l) { 13 | var greeting : string = "Hi there, "; 14 | console.log(greeting + f + " " + l); 15 | 16 | var greeting : string = "Hey there, "; 17 | console.log(greeting + f + " " + l); 18 | } 19 | 20 | printName("Jordan", "Hudgens"); -------------------------------------------------------------------------------- /007_types.ts: -------------------------------------------------------------------------------- 1 | // Boolean 2 | let paidAccount : boolean = false; 3 | 4 | // Number 5 | let age : number = 33; 6 | var taxRate : number = 7.5; 7 | 8 | // String 9 | var fullName : string = "Jordan Hudgens"; 10 | 11 | // Array 12 | var ages : number[] = [33, 28, 11]; 13 | 14 | // Tuple 15 | let player : [number, string, number, number]; 16 | player = [3, 'Corerra', .333, 33]; 17 | 18 | // Enum 19 | enum ApprovalStatus {Approved, Pending, Rejected}; 20 | let job : ApprovalStatus = ApprovalStatus.Pending; 21 | 22 | // Any 23 | var apiData : any[] = [123, 'Jordan', false]; 24 | 25 | // Void 26 | function printOut(msg: string) : void { 27 | console.log(msg); 28 | } -------------------------------------------------------------------------------- /008_type_alias.js: -------------------------------------------------------------------------------- 1 | var players = ["Altuve", "Corerra", "Bregman"]; 2 | console.log(players); 3 | //# sourceMappingURL=008_type_alias.js.map -------------------------------------------------------------------------------- /008_type_alias.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"008_type_alias.js","sourceRoot":"","sources":["008_type_alias.ts"],"names":[],"mappings":"AACA,IAAI,OAAO,GAAiB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAC7D,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC"} -------------------------------------------------------------------------------- /008_type_alias.ts: -------------------------------------------------------------------------------- 1 | type PlayerArray = Array; 2 | let players : PlayerArray = ["Altuve", "Corerra", "Bregman"]; 3 | console.log(players); -------------------------------------------------------------------------------- /009_union_types.js: -------------------------------------------------------------------------------- 1 | var players = ["Altuve", "Corerra", "Bregman"]; 2 | var player_numbers = [25, 3, 2]; 3 | console.log(players); 4 | console.log(player_numbers); 5 | var names; 6 | names = ["Jordan Hudgens", "Tiffany Hudgens"]; 7 | console.log(names); 8 | names = "Kristine Hudgens"; 9 | console.log(names); 10 | //# sourceMappingURL=009_union_types.js.map -------------------------------------------------------------------------------- /009_union_types.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"009_union_types.js","sourceRoot":"","sources":["009_union_types.ts"],"names":[],"mappings":"AACA,IAAI,OAAO,GAAiB,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAC7D,IAAI,cAAc,GAAiB,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACrB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAE5B,IAAI,KAAuB,CAAC;AAC5B,KAAK,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;AAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACnB,KAAK,GAAG,kBAAkB,CAAC;AAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC"} -------------------------------------------------------------------------------- /009_union_types.ts: -------------------------------------------------------------------------------- 1 | type PlayerArray = Array; 2 | let players : PlayerArray = ["Altuve", "Corerra", "Bregman"]; 3 | let player_numbers : PlayerArray = [25, 3, 2]; 4 | console.log(players); 5 | console.log(player_numbers); 6 | 7 | var names : string[]|string; 8 | names = ["Jordan Hudgens", "Tiffany Hudgens"]; 9 | console.log(names); 10 | names = "Kristine Hudgens"; 11 | console.log(names); -------------------------------------------------------------------------------- /010_arithmetic_operators.js: -------------------------------------------------------------------------------- 1 | // +, -, *, /, %, ++, -- 2 | var numOne = 1; 3 | var numTwo = 2; 4 | // Addition 5 | console.log("Addition:"); 6 | console.log(numOne + numTwo); 7 | // Subtraction 8 | console.log("Subtraction:"); 9 | console.log(numOne - numTwo); 10 | // Multiplication 11 | console.log("Multiplication:"); 12 | numOne = 10; 13 | numTwo = 15; 14 | console.log(numOne * numTwo); 15 | // Division 16 | console.log("Division:"); 17 | console.log(numOne / numTwo); 18 | // Modulus 19 | console.log("Modulus:"); 20 | var numThree = 2; 21 | var numFour = 21; 22 | console.log(numFour % numThree); 23 | // Incrementor 24 | console.log("Incrementor:"); 25 | var x = 0; 26 | while (x < 10) { 27 | console.log(x); 28 | x++; 29 | } 30 | // Decrementor 31 | console.log("Decrementor:"); 32 | var x = 10; 33 | while (x > 0) { 34 | console.log(x); 35 | x--; 36 | } 37 | //# sourceMappingURL=010_arithmetic_operators.js.map -------------------------------------------------------------------------------- /010_arithmetic_operators.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"010_arithmetic_operators.js","sourceRoot":"","sources":["010_arithmetic_operators.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,IAAI,MAAM,GAAY,CAAC,CAAC;AACxB,IAAI,MAAM,GAAY,CAAC,CAAC;AAExB,WAAW;AACX,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACzB,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAE7B,cAAc;AACd,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAE7B,iBAAiB;AACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAC/B,MAAM,GAAG,EAAE,CAAC;AACZ,MAAM,GAAG,EAAE,CAAC;AACZ,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAE7B,WAAW;AACX,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACzB,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAE7B,UAAU;AACV,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACxB,IAAI,QAAQ,GAAY,CAAC,CAAC;AAC1B,IAAI,OAAO,GAAY,EAAE,CAAC;AAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC,CAAC;AAEhC,cAAc;AACd,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC5B,IAAI,CAAC,GAAY,CAAC,CAAC;AAEnB,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;IACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACf,CAAC,EAAE,CAAC;AACL,CAAC;AAED,cAAc;AACd,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC5B,IAAI,CAAC,GAAY,EAAE,CAAC;AAEpB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACf,CAAC,EAAE,CAAC;AACL,CAAC"} -------------------------------------------------------------------------------- /010_arithmetic_operators.ts: -------------------------------------------------------------------------------- 1 | // +, -, *, /, %, ++, -- 2 | 3 | var numOne : number = 1; 4 | var numTwo : number = 2; 5 | 6 | // Addition 7 | console.log("Addition:"); 8 | console.log(numOne + numTwo); 9 | 10 | // Subtraction 11 | console.log("Subtraction:"); 12 | console.log(numOne - numTwo); 13 | 14 | // Multiplication 15 | console.log("Multiplication:"); 16 | numOne = 10; 17 | numTwo = 15; 18 | console.log(numOne * numTwo); 19 | 20 | // Division 21 | console.log("Division:"); 22 | console.log(numOne / numTwo); 23 | 24 | // Modulus 25 | console.log("Modulus:"); 26 | var numThree : number = 2; 27 | var numFour : number = 21; 28 | console.log(numFour % numThree); 29 | 30 | // Incrementor 31 | console.log("Incrementor:"); 32 | var x : number = 0; 33 | 34 | while (x < 10) { 35 | console.log(x); 36 | x++; 37 | } 38 | 39 | // Decrementor 40 | console.log("Decrementor:"); 41 | var x : number = 10; 42 | 43 | while (x > 0) { 44 | console.log(x); 45 | x--; 46 | } -------------------------------------------------------------------------------- /011_conditionals.js: -------------------------------------------------------------------------------- 1 | var password = 'zxcvzxcv'; 2 | if (password == 'asdfasdf') { 3 | console.log('Yes, asdfasdf is the password'); 4 | } 5 | else if (password == 'zxcvzxcv') { 6 | console.log('Yes, zxcvzxcv is the password'); 7 | } 8 | else { 9 | console.log('Sorry, permission denied'); 10 | } 11 | //# sourceMappingURL=011_conditionals.js.map -------------------------------------------------------------------------------- /011_conditionals.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"011_conditionals.js","sourceRoot":"","sources":["011_conditionals.ts"],"names":[],"mappings":"AAAA,IAAI,QAAQ,GAAY,UAAU,CAAC;AAEnC,EAAE,CAAA,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAC9C,CAAC;AAAC,IAAI,CAAC,EAAE,CAAA,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAC9C,CAAC;AAAC,IAAI,CAAC,CAAC;IACP,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AACzC,CAAC"} -------------------------------------------------------------------------------- /011_conditionals.ts: -------------------------------------------------------------------------------- 1 | let password : string = 'zxcvzxcv'; 2 | 3 | if(password == 'asdfasdf') { 4 | console.log('Yes, asdfasdf is the password'); 5 | } else if(password == 'zxcvzxcv') { 6 | console.log('Yes, zxcvzxcv is the password'); 7 | } else { 8 | console.log('Sorry, permission denied'); 9 | } -------------------------------------------------------------------------------- /012_conditional_operators.js: -------------------------------------------------------------------------------- 1 | var x = 100; 2 | // if(x == 200) { 3 | // console.log('Condition passed'); 4 | // } 5 | // if(x === 100) { 6 | // console.log('Condition passed'); 7 | // } 8 | // if(x != 100) { 9 | // console.log('Condition passed'); 10 | // } 11 | // if(x > 100) { 12 | // console.log('Condition passed'); 13 | // } 14 | if (x >= 100) { 15 | console.log('Condition passed'); 16 | } 17 | //# sourceMappingURL=012_conditional_operators.js.map -------------------------------------------------------------------------------- /012_conditional_operators.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"012_conditional_operators.js","sourceRoot":"","sources":["012_conditional_operators.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAY,GAAG,CAAC;AAErB,iBAAiB;AACjB,oCAAoC;AACpC,IAAI;AAEJ,kBAAkB;AAClB,oCAAoC;AACpC,IAAI;AAEJ,iBAAiB;AACjB,oCAAoC;AACpC,IAAI;AAEJ,gBAAgB;AAChB,oCAAoC;AACpC,IAAI;AAEJ,EAAE,CAAA,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACb,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACjC,CAAC"} -------------------------------------------------------------------------------- /012_conditional_operators.ts: -------------------------------------------------------------------------------- 1 | let x : number = 100; 2 | 3 | // if(x == 200) { 4 | // console.log('Condition passed'); 5 | // } 6 | 7 | // if(x === 100) { 8 | // console.log('Condition passed'); 9 | // } 10 | 11 | // if(x != 100) { 12 | // console.log('Condition passed'); 13 | // } 14 | 15 | // if(x > 100) { 16 | // console.log('Condition passed'); 17 | // } 18 | 19 | // if(x >= 100) { 20 | // console.log('Condition passed'); 21 | // } 22 | 23 | // if(x < 100) { 24 | // console.log('Condition passed'); 25 | // } 26 | 27 | // if(x <= 100) { 28 | // console.log('Condition passed'); 29 | // } -------------------------------------------------------------------------------- /013_compound_conditionals.js: -------------------------------------------------------------------------------- 1 | var email = 'test@test.com'; 2 | var password = 'asdfasdf'; 3 | // if (password == 'asdfasdf' || password == 'zxcvzxcv') { 4 | // console.log('You are authorized'); 5 | // } else { 6 | // console.log('Permission denied'); 7 | // } 8 | if (!(email == 'test@test.com')) { 9 | console.log('You are authorized'); 10 | } 11 | //# sourceMappingURL=013_compound_conditionals.js.map -------------------------------------------------------------------------------- /013_compound_conditionals.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"013_compound_conditionals.js","sourceRoot":"","sources":["013_compound_conditionals.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAY,eAAe,CAAC;AACrC,IAAI,QAAQ,GAAY,UAAU,CAAC;AAEnC,0DAA0D;AAC1D,sCAAsC;AACtC,WAAW;AACX,qCAAqC;AACrC,IAAI;AAEJ,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACnC,CAAC"} -------------------------------------------------------------------------------- /013_compound_conditionals.ts: -------------------------------------------------------------------------------- 1 | let email : string = 'test@test.com'; 2 | let password : string = 'asdfasdf'; 3 | 4 | // if (password == 'asdfasdf' || password == 'zxcvzxcv') { 5 | // console.log('You are authorized'); 6 | // } else { 7 | // console.log('Permission denied'); 8 | // } 9 | 10 | if (!(email == 'test@test.com')) { 11 | console.log('You are authorized'); 12 | } -------------------------------------------------------------------------------- /014_loops.js: -------------------------------------------------------------------------------- 1 | // var x : number = 0; 2 | // while (x < 10) { 3 | // console.log(x); 4 | // x++; 5 | // } 6 | var players = [3, 10, 4, 5, 1]; 7 | // for in 8 | console.log("For/In"); 9 | for (var player in players) { 10 | console.log(player); 11 | } 12 | // for of 13 | console.log("For/Of"); 14 | for (var _i = 0, players_1 = players; _i < players_1.length; _i++) { 15 | var player = players_1[_i]; 16 | console.log(player); 17 | } 18 | //# sourceMappingURL=014_loops.js.map -------------------------------------------------------------------------------- /014_loops.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"014_loops.js","sourceRoot":"","sources":["014_loops.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,mBAAmB;AACnB,mBAAmB;AACnB,QAAQ;AACR,IAAI;AAEJ,IAAI,OAAO,GAAc,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE1C,SAAS;AACT,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtB,GAAG,CAAC,CAAC,IAAI,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC;AAED,SAAS;AACT,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtB,GAAG,CAAC,CAAe,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,CAAC;IAAtB,IAAI,MAAM,gBAAA;IACd,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACpB"} -------------------------------------------------------------------------------- /014_loops.ts: -------------------------------------------------------------------------------- 1 | // var x : number = 0; 2 | 3 | // while (x < 10) { 4 | // console.log(x); 5 | // x++; 6 | // } 7 | 8 | let players : number[] = [3, 10, 4, 5, 1]; 9 | 10 | // for in 11 | console.log("For/In"); 12 | for (let player in players) { 13 | console.log(player); 14 | } 15 | 16 | // for of 17 | console.log("For/Of"); 18 | for (let player of players) { 19 | console.log(player); 20 | } -------------------------------------------------------------------------------- /015_functions.js: -------------------------------------------------------------------------------- 1 | // function fullName(first, last) { 2 | // return first + " " + last; 3 | // } 4 | // console.log(fullName('Jordan', 'Hudgens')); 5 | function gradeGenerator(grade) { 6 | if (grade < 60) { 7 | return 'F'; 8 | } 9 | else if (grade >= 60 && grade < 70) { 10 | return 'D'; 11 | } 12 | else if (grade >= 70 && grade < 80) { 13 | return 'C'; 14 | } 15 | else if (grade >= 80 && grade < 90) { 16 | return 'B'; 17 | } 18 | else { 19 | return 'A'; 20 | } 21 | } 22 | console.log(gradeGenerator(45)); 23 | console.log(gradeGenerator(100)); 24 | console.log(gradeGenerator(80)); 25 | //# sourceMappingURL=015_functions.js.map -------------------------------------------------------------------------------- /015_functions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"015_functions.js","sourceRoot":"","sources":["015_functions.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,8BAA8B;AAC9B,IAAI;AAEJ,8CAA8C;AAE9C,wBAAwB,KAAa;IACnC,EAAE,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,CAAC;QACP,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /015_functions.ts: -------------------------------------------------------------------------------- 1 | // function fullName(first, last) { 2 | // return first + " " + last; 3 | // } 4 | 5 | // console.log(fullName('Jordan', 'Hudgens')); 6 | 7 | function gradeGenerator(grade: number) : string { 8 | if (grade < 60) { 9 | return 'F'; 10 | } else if (grade >= 60 && grade < 70) { 11 | return 'D'; 12 | } else if (grade >= 70 && grade < 80) { 13 | return 'C'; 14 | } else if (grade >= 80 && grade < 90) { 15 | return 'B'; 16 | } else { 17 | return 'A'; 18 | } 19 | } 20 | 21 | console.log(gradeGenerator(45)); 22 | console.log(gradeGenerator(100)); 23 | console.log(gradeGenerator(80)); -------------------------------------------------------------------------------- /016_5_arrow_functions.js: -------------------------------------------------------------------------------- 1 | var fullName = function (first, last) { 2 | return first + " " + last; 3 | }; 4 | console.log(fullName('Jordan', 'Hudgens')); 5 | // Jordan Hudgens 6 | var gradeGenerator = function (grade) { 7 | if (grade < 60) { 8 | return 'F'; 9 | } 10 | else if (grade >= 60 && grade < 70) { 11 | return 'D'; 12 | } 13 | else if (grade >= 70 && grade < 80) { 14 | return 'C'; 15 | } 16 | else if (grade >= 80 && grade < 90) { 17 | return 'B'; 18 | } 19 | else { 20 | return 'A'; 21 | } 22 | }; 23 | console.log(gradeGenerator(45)); 24 | console.log(gradeGenerator(100)); 25 | console.log(gradeGenerator(80)); 26 | // F 27 | // A 28 | // B 29 | //# sourceMappingURL=016_5_arrow_functions.js.map -------------------------------------------------------------------------------- /016_5_arrow_functions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"016_5_arrow_functions.js","sourceRoot":"","sources":["016_5_arrow_functions.ts"],"names":[],"mappings":"AAAA,IAAI,QAAQ,GAAG,UAAC,KAAK,EAAE,IAAI;IAC1B,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3B,CAAC,CAAA;AAED,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3C,iBAAiB;AAEjB,IAAI,cAAc,GAAG,UAAC,KAAa;IACjC,EAAE,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QAChB,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;IAAC,IAAI,CAAC,CAAC;QACP,MAAM,CAAC,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAA;AAED,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;AAEhC,IAAI;AACJ,IAAI;AACJ,IAAI"} -------------------------------------------------------------------------------- /016_5_arrow_functions.ts: -------------------------------------------------------------------------------- 1 | var fullName = (first, last) => { 2 | return first + " " + last; 3 | } 4 | 5 | console.log(fullName('Jordan', 'Hudgens')); 6 | 7 | // Jordan Hudgens 8 | 9 | var gradeGenerator = (grade: number) : string => { 10 | if (grade < 60) { 11 | return 'F'; 12 | } else if (grade >= 60 && grade < 70) { 13 | return 'D'; 14 | } else if (grade >= 70 && grade < 80) { 15 | return 'C'; 16 | } else if (grade >= 80 && grade < 90) { 17 | return 'B'; 18 | } else { 19 | return 'A'; 20 | } 21 | } 22 | 23 | console.log(gradeGenerator(45)); 24 | console.log(gradeGenerator(100)); 25 | console.log(gradeGenerator(80)); 26 | 27 | // F 28 | // A 29 | // B -------------------------------------------------------------------------------- /016_function_args.js: -------------------------------------------------------------------------------- 1 | // function printAddress(street: string, streetTwo?: string, state = 'AZ') { 2 | // console.log(street); 3 | // if (streetTwo) { 4 | // console.log(streetTwo); 5 | // } 6 | // console.log(state); 7 | // } 8 | // printAddress('123 Any St'); 9 | // printAddress('123 Any St', 'Suite 540'); 10 | // printAddress('123 Any St', 'Suite 540', 'UT'); 11 | function lineupCard(team) { 12 | var players = []; 13 | for (var _i = 1; _i < arguments.length; _i++) { 14 | players[_i - 1] = arguments[_i]; 15 | } 16 | console.log('Team: ' + team); 17 | for (var _a = 0, players_1 = players; _a < players_1.length; _a++) { 18 | var player = players_1[_a]; 19 | console.log(player); 20 | } 21 | } 22 | lineupCard('Astros', 'Altuve', 'Correra', 'Bregman'); 23 | //# sourceMappingURL=016_function_args.js.map -------------------------------------------------------------------------------- /016_function_args.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"016_function_args.js","sourceRoot":"","sources":["016_function_args.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wBAAwB;AACxB,oBAAoB;AACpB,4BAA4B;AAC5B,KAAK;AACL,uBAAuB;AACvB,IAAI;AAEJ,8BAA8B;AAC9B,2CAA2C;AAC3C,iDAAiD;AAEjD,oBAAoB,IAAY;IAAE,iBAAoB;SAApB,WAAoB,CAApB,sBAAoB,CAApB,IAAoB;QAApB,gCAAoB;;IACrD,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAC7B,GAAG,CAAC,CAAe,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,CAAC;QAAtB,IAAI,MAAM,gBAAA;QACd,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KACpB;AACF,CAAC;AAED,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC"} -------------------------------------------------------------------------------- /016_function_args.ts: -------------------------------------------------------------------------------- 1 | // function printAddress(street: string, streetTwo?: string, state = 'AZ') { 2 | // console.log(street); 3 | // if (streetTwo) { 4 | // console.log(streetTwo); 5 | // } 6 | // console.log(state); 7 | // } 8 | 9 | // printAddress('123 Any St'); 10 | // printAddress('123 Any St', 'Suite 540'); 11 | // printAddress('123 Any St', 'Suite 540', 'UT'); 12 | 13 | function lineupCard(team: string, ...players: string[]) { 14 | console.log('Team: ' + team); 15 | for (let player of players) { 16 | console.log(player); 17 | } 18 | } 19 | 20 | lineupCard('Astros', 'Altuve', 'Correra', 'Bregman'); -------------------------------------------------------------------------------- /017_function_declarations_vs_expressions.js: -------------------------------------------------------------------------------- 1 | console.log(fullName('Jordan', 'Hudgens')); 2 | // console.log(otherFullName('Jordan', 'Hudgens')); 3 | // console.log(thirdFullName('Jordan', 'Hudgens')); 4 | // Function declaration 5 | function fullName(first, last) { 6 | return first + " " + last; 7 | } 8 | // Function expression 9 | var otherFullName; 10 | otherFullName = function (first, last) { 11 | return first + " " + last; 12 | }; 13 | var thirdFullName = function (first, last) { 14 | return first + " " + last; 15 | }; 16 | //# sourceMappingURL=017_function_declarations_vs_expressions.js.map -------------------------------------------------------------------------------- /017_function_declarations_vs_expressions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"017_function_declarations_vs_expressions.js","sourceRoot":"","sources":["017_function_declarations_vs_expressions.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAC3C,mDAAmD;AACnD,mDAAmD;AAEnD,uBAAuB;AACvB,kBAAkB,KAAc,EAAE,IAAa;IAC9C,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3B,CAAC;AAGD,sBAAsB;AACtB,IAAI,aAAyD,CAAC;AAE9D,aAAa,GAAG,UAAU,KAAc,EAAE,IAAa;IACtD,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3B,CAAC,CAAA;AAED,IAAI,aAAa,GAA+C,UAAU,KAAc,EAAE,IAAa;IACtG,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3B,CAAC,CAAA"} -------------------------------------------------------------------------------- /017_function_declarations_vs_expressions.ts: -------------------------------------------------------------------------------- 1 | console.log(fullName('Jordan', 'Hudgens')); 2 | // console.log(otherFullName('Jordan', 'Hudgens')); 3 | // console.log(thirdFullName('Jordan', 'Hudgens')); 4 | 5 | // Function declaration 6 | function fullName(first : string, last : string) : string { 7 | return first + " " + last; 8 | } 9 | 10 | 11 | // Function expression 12 | var otherFullName : (first : string, last : string) => string; 13 | 14 | otherFullName = function (first : string, last : string) { 15 | return first + " " + last; 16 | } 17 | 18 | var thirdFullName : (first : string, last : string) => string = function (first : string, last : string) { 19 | return first + " " + last; 20 | } -------------------------------------------------------------------------------- /018_5_immediatel_invoked_arguments.js: -------------------------------------------------------------------------------- 1 | // Function expression 2 | var fullName; 3 | fullName = function (first, last) { 4 | return first + " " + last; 5 | }; 6 | console.log(fullName('Jordan', 'Hudgens')); 7 | // Immediately invoked version 8 | (function (first, last) { 9 | console.log(first + " " + last); 10 | })('Tiffany', 'Hudgens'); 11 | //# sourceMappingURL=018_5_immediatel_invoked_arguments.js.map -------------------------------------------------------------------------------- /018_5_immediatel_invoked_arguments.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"018_5_immediatel_invoked_arguments.js","sourceRoot":"","sources":["018_5_immediatel_invoked_arguments.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,IAAI,QAAoD,CAAC;AAEzD,QAAQ,GAAG,UAAS,KAAc,EAAE,IAAa;IAChD,MAAM,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3B,CAAC,CAAA;AAED,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3C,8BAA8B;AAC9B,CAAC,UAAS,KAAc,EAAE,IAAa;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC"} -------------------------------------------------------------------------------- /018_5_immediatel_invoked_arguments.ts: -------------------------------------------------------------------------------- 1 | // Function expression 2 | var fullName : (first : string, last : string) => string; 3 | 4 | fullName = function(first : string, last : string) { 5 | return first + " " + last; 6 | } 7 | 8 | console.log(fullName('Jordan', 'Hudgens')); 9 | 10 | // Immediately invoked version 11 | (function(first : string, last : string) { 12 | console.log(first + " " + last); 13 | })('Tiffany', 'Hudgens'); -------------------------------------------------------------------------------- /018_immediately_invoked_functions.js: -------------------------------------------------------------------------------- 1 | var names = ['Jordan', 'Tiffany', 'Kristine']; 2 | var counter = 0; 3 | (function () { 4 | for (var name_1 in names) { 5 | counter++; 6 | } 7 | })(); 8 | console.log(counter); 9 | //# sourceMappingURL=018_immediately_invoked_functions.js.map -------------------------------------------------------------------------------- /018_immediately_invoked_functions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"018_immediately_invoked_functions.js","sourceRoot":"","sources":["018_immediately_invoked_functions.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACzD,IAAI,OAAO,GAAY,CAAC,CAAC;AAEzB,CAAC;IACA,GAAG,CAAC,CAAC,IAAI,MAAI,IAAI,KAAK,CAAC,CAAC,CAAC;QACxB,OAAO,EAAE,CAAC;IACX,CAAC;AACF,CAAC,CAAC,EAAE,CAAC;AAEL,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC"} -------------------------------------------------------------------------------- /018_immediately_invoked_functions.ts: -------------------------------------------------------------------------------- 1 | var names : string[] = ['Jordan', 'Tiffany', 'Kristine']; 2 | var counter : number = 0; 3 | 4 | (function() { 5 | for (let name in names) { 6 | counter++; 7 | } 8 | })(); 9 | 10 | console.log(counter); -------------------------------------------------------------------------------- /019_closure_introduction.js: -------------------------------------------------------------------------------- 1 | // functions have access to any public variables in the outer scope 2 | // function nameFunction(name: string) : void { 3 | // var n : string = name; 4 | // function printName() { 5 | // console.log(n); 6 | // } 7 | // printName(); 8 | // } 9 | // nameFunction('Jordan'); 10 | // * * * 11 | // The inner function maintain access to the outer scope even AFTER the values are returned! 12 | // function nameFunction(name: string) { 13 | // var n : string = name; 14 | // return function() { 15 | // console.log(n); 16 | // } 17 | // } 18 | // var nameAgain = nameFunction('Tiffany'); 19 | // nameAgain(); 20 | // * * * 21 | function lineup() { 22 | var nowBatting = 1; 23 | return { 24 | nextBatter: function () { nowBatting++; }, 25 | currentBatter: function () { return nowBatting; } 26 | }; 27 | } 28 | var batters = lineup(); 29 | console.log(batters.currentBatter()); 30 | batters.nextBatter(); 31 | console.log(batters.currentBatter()); 32 | batters.nextBatter(); 33 | console.log(batters.currentBatter()); 34 | var pitchers = lineup(); 35 | console.log(pitchers.currentBatter()); 36 | //# sourceMappingURL=019_closure_introduction.js.map -------------------------------------------------------------------------------- /019_closure_introduction.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"019_closure_introduction.js","sourceRoot":"","sources":["019_closure_introduction.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE,+CAA+C;AAC/C,0BAA0B;AAE1B,0BAA0B;AAC1B,oBAAoB;AACpB,KAAK;AAEL,gBAAgB;AAChB,IAAI;AAEJ,0BAA0B;AAE1B,QAAQ;AAER,4FAA4F;AAE5F,wCAAwC;AACxC,0BAA0B;AAE1B,uBAAuB;AACvB,oBAAoB;AACpB,KAAK;AACL,IAAI;AAEJ,2CAA2C;AAC3C,eAAe;AAEf,QAAQ;AAER;IACC,IAAI,UAAU,GAAY,CAAC,CAAC;IAE5B,MAAM,CAAC;QACN,UAAU,gBAAK,UAAU,EAAE,CAAA,CAAC,CAAC;QAC7B,aAAa,gBAAK,MAAM,CAAC,UAAU,CAAA,CAAC,CAAC;KACrC,CAAA;AACF,CAAC;AAED,IAAI,OAAO,GAAG,MAAM,EAAE,CAAC;AAEvB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;AACrC,OAAO,CAAC,UAAU,EAAE,CAAC;AACrB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;AACrC,OAAO,CAAC,UAAU,EAAE,CAAC;AACrB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;AAErC,IAAI,QAAQ,GAAG,MAAM,EAAE,CAAC;AACxB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC"} -------------------------------------------------------------------------------- /019_closure_introduction.ts: -------------------------------------------------------------------------------- 1 | // functions have access to any public variables in the outer scope 2 | 3 | // function nameFunction(name: string) : void { 4 | // var n : string = name; 5 | 6 | // function printName() { 7 | // console.log(n); 8 | // } 9 | 10 | // printName(); 11 | // } 12 | 13 | // nameFunction('Jordan'); 14 | 15 | // * * * 16 | 17 | // The inner function maintain access to the outer scope even AFTER the values are returned! 18 | 19 | // function nameFunction(name: string) { 20 | // var n : string = name; 21 | 22 | // return function() { 23 | // console.log(n); 24 | // } 25 | // } 26 | 27 | // var nameAgain = nameFunction('Tiffany'); 28 | // nameAgain(); 29 | 30 | // * * * 31 | 32 | function lineup() { 33 | var nowBatting : number = 1; 34 | 35 | return { 36 | nextBatter() { nowBatting++ }, 37 | currentBatter() { return nowBatting } 38 | } 39 | } 40 | 41 | let batters = lineup(); 42 | 43 | console.log(batters.currentBatter()); 44 | batters.nextBatter(); 45 | console.log(batters.currentBatter()); 46 | batters.nextBatter(); 47 | console.log(batters.currentBatter()); 48 | 49 | let pitchers = lineup(); 50 | console.log(pitchers.currentBatter()); -------------------------------------------------------------------------------- /020_classes.js: -------------------------------------------------------------------------------- 1 | var Invoice = (function () { 2 | function Invoice(name, city, state) { 3 | this.name = name; 4 | this.city = city; 5 | this.state = state; 6 | this.companyProfile = name + ", " + city + ", " + state; 7 | } 8 | return Invoice; 9 | }()); 10 | var googleInvoice = new Invoice('Google', 'Mountain View', 'State'); 11 | var yahooInvoice = new Invoice('Yahoo', 'SF', 'State'); 12 | console.log(googleInvoice.companyProfile); 13 | console.log(yahooInvoice.companyProfile); 14 | //# sourceMappingURL=020_classes.js.map -------------------------------------------------------------------------------- /020_classes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"020_classes.js","sourceRoot":"","sources":["020_classes.ts"],"names":[],"mappings":"AAAA;IAGC,iBAAmB,IAAI,EAAS,IAAI,EAAS,KAAK;QAA/B,SAAI,GAAJ,IAAI,CAAA;QAAS,SAAI,GAAJ,IAAI,CAAA;QAAS,UAAK,GAAL,KAAK,CAAA;QACjD,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IACzD,CAAC;IACF,cAAC;AAAD,CAAC,AAND,IAMC;AAED,IAAI,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;AACpE,IAAI,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAGvD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;AAC1C,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC"} -------------------------------------------------------------------------------- /020_classes.ts: -------------------------------------------------------------------------------- 1 | class Invoice { 2 | companyProfile : string; 3 | 4 | constructor(public name, public city, public state) { 5 | this.companyProfile = name + ", " + city + ", " + state; 6 | } 7 | } 8 | 9 | var googleInvoice = new Invoice('Google', 'Mountain View', 'State'); 10 | var yahooInvoice = new Invoice('Yahoo', 'SF', 'State'); 11 | 12 | 13 | console.log(googleInvoice.companyProfile); 14 | console.log(yahooInvoice.companyProfile); -------------------------------------------------------------------------------- /021_inheritance.js: -------------------------------------------------------------------------------- 1 | var __extends = (this && this.__extends) || function (d, b) { 2 | for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; 3 | function __() { this.constructor = d; } 4 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 5 | }; 6 | var Report = (function () { 7 | function Report(name) { 8 | this.name = name; 9 | this.companyProfile = name; 10 | } 11 | return Report; 12 | }()); 13 | var Invoice = (function (_super) { 14 | __extends(Invoice, _super); 15 | function Invoice(name, total) { 16 | _super.call(this, name); 17 | this.name = name; 18 | this.total = total; 19 | } 20 | Invoice.prototype.printInvoice = function () { 21 | return this.name + ", " + this.total; 22 | }; 23 | return Invoice; 24 | }(Report)); 25 | var BillOfLading = (function (_super) { 26 | __extends(BillOfLading, _super); 27 | function BillOfLading(name, city, state) { 28 | _super.call(this, name); 29 | this.name = name; 30 | this.city = city; 31 | this.state = state; 32 | } 33 | BillOfLading.prototype.printBol = function () { 34 | return this.name + ", " + this.city + ", " + this.state; 35 | }; 36 | return BillOfLading; 37 | }(Report)); 38 | var invoice = new Invoice('Google', 200); 39 | var bol = new BillOfLading('Google', 'Scottsdale', 'AZ'); 40 | console.log(invoice.printInvoice()); 41 | console.log(bol.printBol()); 42 | //# sourceMappingURL=021_inheritance.js.map -------------------------------------------------------------------------------- /021_inheritance.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"021_inheritance.js","sourceRoot":"","sources":["021_inheritance.ts"],"names":[],"mappings":";;;;;AAAA;IAGC,gBAAmB,IAAa;QAAb,SAAI,GAAJ,IAAI,CAAS;QAC/B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC5B,CAAC;IACF,aAAC;AAAD,CAAC,AAND,IAMC;AAED;IAAsB,2BAAM;IAC1B,iBAAmB,IAAa,EAAS,KAAc;QAAI,kBAAM,IAAI,CAAC,CAAC;QAApD,SAAI,GAAJ,IAAI,CAAS;QAAS,UAAK,GAAL,KAAK,CAAS;IAAiB,CAAC;IAEzE,8BAAY,GAAZ;QACC,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;IACtC,CAAC;IACH,cAAC;AAAD,CAAC,AAND,CAAsB,MAAM,GAM3B;AAED;IAA2B,gCAAM;IAChC,sBAAmB,IAAa,EAAS,IAAa,EAAS,KAAc;QAAI,kBAAM,IAAI,CAAC,CAAC;QAA1E,SAAI,GAAJ,IAAI,CAAS;QAAS,SAAI,GAAJ,IAAI,CAAS;QAAS,UAAK,GAAL,KAAK,CAAS;IAAiB,CAAC;IAE/F,+BAAQ,GAAR;QACE,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;IACzD,CAAC;IACH,mBAAC;AAAD,CAAC,AAND,CAA2B,MAAM,GAMhC;AAED,IAAI,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACzC,IAAI,GAAG,GAAG,IAAI,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;AAEzD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;AACpC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC"} -------------------------------------------------------------------------------- /021_inheritance.ts: -------------------------------------------------------------------------------- 1 | class Report { 2 | companyProfile : string; 3 | 4 | constructor(public name : string) { 5 | this.companyProfile = name; 6 | } 7 | } 8 | 9 | class Invoice extends Report { 10 | constructor(public name : string, public total : number) { super(name); } 11 | 12 | printInvoice() { 13 | return this.name + ", " + this.total; 14 | } 15 | } 16 | 17 | class BillOfLading extends Report { 18 | constructor(public name : string, public city : string, public state : string) { super(name); } 19 | 20 | printBol() { 21 | return this.name + ", " + this.city + ", " + this.state; 22 | } 23 | } 24 | 25 | var invoice = new Invoice('Google', 200); 26 | var bol = new BillOfLading('Google', 'Scottsdale', 'AZ'); 27 | 28 | console.log(invoice.printInvoice()); 29 | console.log(bol.printBol()); -------------------------------------------------------------------------------- /022_objects.js: -------------------------------------------------------------------------------- 1 | var realUser = { 2 | email: 'test@test.com', 3 | firstName: 'Jordan', 4 | lastName: 'Hudgens', 5 | sayHi: function () { 6 | return "Hey there!"; 7 | } 8 | }; 9 | console.log(realUser.email); 10 | console.log(realUser.firstName); 11 | console.log(realUser.lastName); 12 | console.log(realUser.sayHi()); 13 | //# sourceMappingURL=022_objects.js.map -------------------------------------------------------------------------------- /022_objects.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"022_objects.js","sourceRoot":"","sources":["022_objects.ts"],"names":[],"mappings":"AAAA,IAAI,QAAQ,GAAG;IACd,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,SAAS;IACnB,KAAK;QACJ,MAAM,CAAC,YAAY,CAAC;IACrB,CAAC;CACD,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAChC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC"} -------------------------------------------------------------------------------- /022_objects.ts: -------------------------------------------------------------------------------- 1 | var realUser = { 2 | email: 'test@test.com', 3 | firstName: 'Jordan', 4 | lastName: 'Hudgens', 5 | sayHi() { 6 | return "Hey there!"; 7 | } 8 | }; 9 | 10 | console.log(realUser.email); 11 | console.log(realUser.firstName); 12 | console.log(realUser.lastName); 13 | console.log(realUser.sayHi()); -------------------------------------------------------------------------------- /023_interfaces.js: -------------------------------------------------------------------------------- 1 | function profile(user) { 2 | return "Welcome, " + user.email; 3 | } 4 | var realUser = { 5 | email: 'test@test.com' 6 | }; 7 | console.log(profile(realUser)); 8 | //# sourceMappingURL=023_interfaces.js.map -------------------------------------------------------------------------------- /023_interfaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"023_interfaces.js","sourceRoot":"","sources":["023_interfaces.ts"],"names":[],"mappings":"AAMA,iBAAiB,IAAU;IAC1B,MAAM,CAAC,cAAY,IAAI,CAAC,KAAO,CAAC;AACjC,CAAC;AAED,IAAI,QAAQ,GAAG;IACd,KAAK,EAAE,eAAe;CACtB,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /023_interfaces.ts: -------------------------------------------------------------------------------- 1 | interface User { 2 | email : string; 3 | firstName? : string; 4 | lastName? : string; 5 | } 6 | 7 | function profile(user: User) : string { 8 | return `Welcome, ${user.email}`; 9 | } 10 | 11 | var realUser = { 12 | email: 'test@test.com' 13 | }; 14 | 15 | console.log(profile(realUser)); -------------------------------------------------------------------------------- /024_interface_functions.js: -------------------------------------------------------------------------------- 1 | var myInvoice; 2 | myInvoice = function (n, t) { 3 | console.log(n); 4 | console.log(t); 5 | }; 6 | myInvoice('Google', 500); 7 | //# sourceMappingURL=024_interface_functions.js.map -------------------------------------------------------------------------------- /024_interface_functions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"024_interface_functions.js","sourceRoot":"","sources":["024_interface_functions.ts"],"names":[],"mappings":"AAIA,IAAI,SAAuB,CAAC;AAC5B,SAAS,GAAG,UAAS,CAAC,EAAE,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChB,CAAC,CAAA;AAED,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC"} -------------------------------------------------------------------------------- /024_interface_functions.ts: -------------------------------------------------------------------------------- 1 | interface InvoiceFunc { 2 | (name : string, total : number) : void; 3 | } 4 | 5 | let myInvoice : InvoiceFunc; 6 | myInvoice = function(n, t) { 7 | console.log(n); 8 | console.log(t); 9 | } 10 | 11 | myInvoice('Google', 500); -------------------------------------------------------------------------------- /025_interface_classes.js: -------------------------------------------------------------------------------- 1 | var Admin = (function () { 2 | function Admin(email) { 3 | this.email = email; 4 | this.role = 'Admin'; 5 | } 6 | return Admin; 7 | }()); 8 | function profile(user) { 9 | return "Welcome, " + user.email; 10 | } 11 | var joe = new Admin('joe@example.com'); 12 | console.log(joe.role); 13 | var Post = (function () { 14 | function Post(post) { 15 | this.title = post.title; 16 | this.body = post.body; 17 | } 18 | Post.prototype.printPost = function () { 19 | console.log(this.title); 20 | console.log(this.body); 21 | }; 22 | return Post; 23 | }()); 24 | var post = new Post({ title: "My Great Title", body: "Some content" }); 25 | console.log(post.title); 26 | console.log(post.body); 27 | post.printPost(); 28 | //# sourceMappingURL=025_interface_classes.js.map -------------------------------------------------------------------------------- /025_interface_classes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"025_interface_classes.js","sourceRoot":"","sources":["025_interface_classes.ts"],"names":[],"mappings":"AAOA;IAEC,eAAmB,KAAc;QAAd,UAAK,GAAL,KAAK,CAAS;QAChC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;IACrB,CAAC;IACF,YAAC;AAAD,CAAC,AALD,IAKC;AAED,iBAAiB,IAAU;IAC1B,MAAM,CAAC,cAAY,IAAI,CAAC,KAAO,CAAC;AACjC,CAAC;AAED,IAAI,GAAG,GAAG,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACvC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAQtB;IAIC,cAAY,IAAW;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,wBAAS,GAAT;QACC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACF,WAAC;AAAD,CAAC,AAbD,IAaC;AAED,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAC,CAAC,CAAC;AACtE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvB,IAAI,CAAC,SAAS,EAAE,CAAC"} -------------------------------------------------------------------------------- /025_interface_classes.ts: -------------------------------------------------------------------------------- 1 | // Loosely connected Interface with Class 2 | interface User { 3 | email: string; 4 | firstName? : string; 5 | lastName? : string; 6 | } 7 | 8 | class Admin { 9 | role : string; 10 | constructor(public email : string) { 11 | this.role = 'Admin'; 12 | } 13 | } 14 | 15 | function profile(user: User) : string { 16 | return `Welcome, ${user.email}`; 17 | } 18 | 19 | var joe = new Admin('joe@example.com'); 20 | console.log(joe.role); 21 | 22 | // Direct implementation 23 | interface IPost { 24 | title: string; 25 | body: string; 26 | } 27 | 28 | class Post implements IPost { 29 | title: string; 30 | body: string; 31 | 32 | constructor(post: IPost) { 33 | this.title = post.title; 34 | this.body = post.body; 35 | } 36 | 37 | printPost() { 38 | console.log(this.title); 39 | console.log(this.body); 40 | } 41 | } 42 | 43 | var post = new Post({ title: "My Great Title", body: "Some content"}); 44 | console.log(post.title); 45 | console.log(post.body); 46 | post.printPost(); 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /026_namespaces.js: -------------------------------------------------------------------------------- 1 | var Blog; 2 | (function (Blog) { 3 | var Post = (function () { 4 | function Post(post) { 5 | this.title = post.title; 6 | this.body = post.body; 7 | } 8 | Post.prototype.printPost = function () { 9 | console.log(this.title); 10 | console.log(this.body); 11 | }; 12 | return Post; 13 | }()); 14 | Blog.Post = Post; 15 | })(Blog || (Blog = {})); 16 | var Content; 17 | (function (Content) { 18 | var Post = (function () { 19 | function Post(post) { 20 | this.title = post.title; 21 | this.body = post.body; 22 | this.slug = post.slug; 23 | this.seoKeywords = post.seoKeywords; 24 | } 25 | Post.prototype.printPost = function () { 26 | console.log(this.title); 27 | console.log(this.body); 28 | console.log(this.slug); 29 | console.log(this.seoKeywords); 30 | }; 31 | return Post; 32 | }()); 33 | Content.Post = Post; 34 | })(Content || (Content = {})); 35 | var blogPost = new Blog.Post({ 36 | title: "My Great Post", 37 | body: "Some content" 38 | }); 39 | blogPost.printPost(); 40 | var contentPost = new Content.Post({ 41 | title: "My Great Post", 42 | body: "Some content", 43 | slug: 'my-great-post', 44 | seoKeywords: 'any, words' 45 | }); 46 | contentPost.printPost(); 47 | //# sourceMappingURL=026_namespaces.js.map -------------------------------------------------------------------------------- /026_namespaces.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"026_namespaces.js","sourceRoot":"","sources":["026_namespaces.ts"],"names":[],"mappings":"AAAA,IAAU,IAAI,CAoBb;AApBD,WAAU,IAAI,EAAC,CAAC;IAMf;QAIE,cAAY,IAAW;YACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACxB,CAAC;QAED,wBAAS,GAAT;YACC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;QACH,WAAC;IAAD,CAAC,AAbD,IAaC;IAbY,SAAI,OAahB,CAAA;AACF,CAAC,EApBS,IAAI,KAAJ,IAAI,QAoBb;AAED,IAAU,OAAO,CA4BhB;AA5BD,WAAU,OAAO,EAAC,CAAC;IAQlB;QAME,cAAY,IAAW;YACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,CAAC;QAED,wBAAS,GAAT;YACC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;QACH,WAAC;IAAD,CAAC,AAnBD,IAmBC;IAnBY,YAAI,OAmBhB,CAAA;AACF,CAAC,EA5BS,OAAO,KAAP,OAAO,QA4BhB;AAGD,IAAI,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACpB,CAAC,CAAC;AAEH,QAAQ,CAAC,SAAS,EAAE,CAAC;AAErB,IAAI,WAAW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAClC,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,YAAY;CACzB,CAAC,CAAC;AAEH,WAAW,CAAC,SAAS,EAAE,CAAC"} -------------------------------------------------------------------------------- /026_namespaces.ts: -------------------------------------------------------------------------------- 1 | namespace Blog { 2 | export interface IPost { 3 | title: string; 4 | body: string; 5 | } 6 | 7 | export class Post implements IPost { 8 | title: string; 9 | body: string; 10 | 11 | constructor(post: IPost) { 12 | this.title = post.title; 13 | this.body = post.body; 14 | } 15 | 16 | printPost() { 17 | console.log(this.title); 18 | console.log(this.body); 19 | } 20 | } 21 | } 22 | 23 | namespace Content { 24 | export interface IPost { 25 | title: string; 26 | body: string; 27 | slug: string; 28 | seoKeywords: string; 29 | } 30 | 31 | export class Post implements IPost { 32 | title: string; 33 | body: string; 34 | slug: string; 35 | seoKeywords: string; 36 | 37 | constructor(post: IPost) { 38 | this.title = post.title; 39 | this.body = post.body; 40 | this.slug = post.slug; 41 | this.seoKeywords = post.seoKeywords; 42 | } 43 | 44 | printPost() { 45 | console.log(this.title); 46 | console.log(this.body); 47 | console.log(this.slug); 48 | console.log(this.seoKeywords); 49 | } 50 | } 51 | } 52 | 53 | 54 | var blogPost = new Blog.Post({ 55 | title: "My Great Post", 56 | body: "Some content" 57 | }); 58 | 59 | blogPost.printPost(); 60 | 61 | var contentPost = new Content.Post({ 62 | title: "My Great Post", 63 | body: "Some content", 64 | slug: 'my-great-post', 65 | seoKeywords: 'any, words' 66 | }); 67 | 68 | contentPost.printPost(); 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /027_this.js: -------------------------------------------------------------------------------- 1 | var Invoice = (function () { 2 | function Invoice(total) { 3 | this.total = total; 4 | } 5 | Invoice.prototype.printTotal = function () { 6 | console.log(this.total); 7 | }; 8 | // printLater(time : number) { 9 | // setTimeout(function() { 10 | // console.log(this.total); 11 | // }, time); 12 | // } 13 | Invoice.prototype.printLater = function (time) { 14 | var _this = this; 15 | setTimeout(function () { 16 | console.log(_this.total); 17 | }, time); 18 | }; 19 | return Invoice; 20 | }()); 21 | var invoice = new Invoice(400); 22 | invoice.printTotal(); 23 | invoice.printLater(1000); 24 | //# sourceMappingURL=027_this.js.map -------------------------------------------------------------------------------- /027_this.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"027_this.js","sourceRoot":"","sources":["027_this.ts"],"names":[],"mappings":"AAAA;IAGC,iBAAY,KAAc;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,4BAAU,GAAV;QACC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,8BAA8B;IAC9B,2BAA2B;IAC3B,6BAA6B;IAC7B,aAAa;IACb,IAAI;IAEJ,4BAAU,GAAV,UAAW,IAAa;QAAxB,iBAIC;QAHA,UAAU,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC;IACF,cAAC;AAAD,CAAC,AAtBD,IAsBC;AAED,IAAI,OAAO,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;AAC/B,OAAO,CAAC,UAAU,EAAE,CAAC;AACrB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC"} -------------------------------------------------------------------------------- /027_this.ts: -------------------------------------------------------------------------------- 1 | class Invoice { 2 | total : number; 3 | 4 | constructor(total : number) { 5 | this.total = total; 6 | } 7 | 8 | printTotal() { 9 | console.log(this.total); 10 | } 11 | 12 | // printLater(time : number) { 13 | // setTimeout(function() { 14 | // console.log(this.total); 15 | // }, time); 16 | // } 17 | 18 | printLater(time : number) { 19 | setTimeout(() => { 20 | console.log(this.total); 21 | }, time); 22 | } 23 | } 24 | 25 | var invoice = new Invoice(400); 26 | invoice.printTotal(); 27 | invoice.printLater(1000); -------------------------------------------------------------------------------- /028_higher_order_functions_callbacks.js: -------------------------------------------------------------------------------- 1 | var dbQuery = function () { 2 | console.log('Query results'); 3 | }; 4 | function loadPage(q) { 5 | console.log("Header"); 6 | q(); 7 | console.log("Sidebar"); 8 | console.log("Footer"); 9 | } 10 | loadPage(dbQuery); 11 | //# sourceMappingURL=028_higher_order_functions_callbacks.js.map -------------------------------------------------------------------------------- /028_higher_order_functions_callbacks.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"028_higher_order_functions_callbacks.js","sourceRoot":"","sources":["028_higher_order_functions_callbacks.ts"],"names":[],"mappings":"AAAA,IAAI,OAAO,GAAG;IACb,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC9B,CAAC,CAAA;AAED,kBAAkB,CAAc;IAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtB,CAAC,EAAE,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC;AAED,QAAQ,CAAC,OAAO,CAAC,CAAC"} -------------------------------------------------------------------------------- /028_higher_order_functions_callbacks.ts: -------------------------------------------------------------------------------- 1 | var dbQuery = function() : void { 2 | setTimeout(() => { 3 | console.log('Query results'); 4 | }, 3000); 5 | } 6 | 7 | function loadPage(q : () => void) { 8 | console.log("Header"); 9 | q(); 10 | console.log("Sidebar"); 11 | console.log("Footer"); 12 | } 13 | 14 | loadPage(dbQuery); -------------------------------------------------------------------------------- /029_promises.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | // Start mowing -> Pending 3 | // Complete mowing process -> Resolve 4 | // Did not complete mowing process -> Reject 5 | let performUpload = function (imgStatus) { 6 | return new Promise((resolve) => { 7 | console.log(`Status: ${imgStatus}`); 8 | setTimeout(() => { 9 | resolve({ imgStatus: imgStatus }); 10 | }, 1000); 11 | }); 12 | }; 13 | var upload; 14 | var compress; 15 | var transfer; 16 | performUpload('uploading...') 17 | .then((res) => { 18 | upload = res; 19 | return performUpload('compressing...'); 20 | }) 21 | .then((res) => { 22 | compress = res; 23 | return performUpload('transferring...'); 24 | }) 25 | .then((res) => { 26 | transfer = res; 27 | return performUpload('Image upload completed.'); 28 | }); 29 | //# sourceMappingURL=029_promises.js.map -------------------------------------------------------------------------------- /029_promises.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"029_promises.js","sourceRoot":"","sources":["029_promises.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,0BAA0B;AAC1B,qCAAqC;AACrC,4CAA4C;AAE5C,IAAI,aAAa,GAAG,UAAS,SAAkB;IAC9C,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO;QAC1B,OAAO,CAAC,GAAG,CAAC,WAAW,SAAS,EAAE,CAAC,CAAC;QACpC,UAAU,CAAC;YACV,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;QACnC,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACJ,CAAC,CAAA;AAED,IAAI,MAAM,CAAC;AACX,IAAI,QAAQ,CAAC;AACb,IAAI,QAAQ,CAAC;AAEb,aAAa,CAAC,cAAc,CAAC;KAC5B,IAAI,CAAC,CAAC,GAAG;IACT,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;AACxC,CAAC,CAAC;KACD,IAAI,CAAC,CAAC,GAAG;IACT,QAAQ,GAAG,GAAG,CAAC;IACf,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;AACzC,CAAC,CAAC;KACD,IAAI,CAAC,CAAC,GAAG;IACT,QAAQ,GAAG,GAAG,CAAC;IACf,MAAM,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /029_promises.ts: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | // Start mowing -> Pending 4 | // Complete mowing process -> Resolve 5 | // Did not complete mowing process -> Reject 6 | 7 | let performUpload = function(imgStatus : string) : Promise<{imgStatus : string}> { 8 | return new Promise((resolve) => { 9 | console.log(`Status: ${imgStatus}`); 10 | setTimeout(() => { 11 | resolve({ imgStatus: imgStatus }); 12 | }, 1000); 13 | }); 14 | } 15 | 16 | var upload; 17 | var compress; 18 | var transfer; 19 | 20 | performUpload('uploading...') 21 | .then((res) => { 22 | upload = res; 23 | return performUpload('compressing...'); 24 | }) 25 | .then((res) => { 26 | compress = res; 27 | return performUpload('transferring...'); 28 | }) 29 | .then((res) => { 30 | transfer = res; 31 | return performUpload('Image upload completed.'); 32 | }); -------------------------------------------------------------------------------- /030_decorator_introduction.js: -------------------------------------------------------------------------------- 1 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 2 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 3 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 4 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 5 | return c > 3 && r && Object.defineProperty(target, key, r), r; 6 | }; 7 | var __metadata = (this && this.__metadata) || function (k, v) { 8 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 9 | }; 10 | var Post = (function () { 11 | function Post() { 12 | } 13 | Post.prototype.someFunction = function () { }; 14 | __decorate([ 15 | processOne(), 16 | processTwo(), 17 | __metadata('design:type', Function), 18 | __metadata('design:paramtypes', []), 19 | __metadata('design:returntype', void 0) 20 | ], Post.prototype, "someFunction", null); 21 | return Post; 22 | }()); 23 | function processOne() { 24 | console.log("processOne has run"); 25 | return function (target, propertyKey, descriptor) { 26 | console.log("processOne has been called"); 27 | }; 28 | } 29 | function processTwo() { 30 | console.log("processTwo has run"); 31 | return function (target, propertyKey, descriptor) { 32 | console.log("processTwo has been called"); 33 | }; 34 | } 35 | //# sourceMappingURL=030_decorator_introduction.js.map -------------------------------------------------------------------------------- /030_decorator_introduction.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"030_decorator_introduction.js","sourceRoot":"","sources":["030_decorator_introduction.ts"],"names":[],"mappings":";;;;;;;;;AAAA;IAAA;IAIA,CAAC;IADC,2BAAY,GAAZ,cAAgB,CAAC;IAFjB;QAAC,UAAU,EAAE;QACZ,UAAU,EAAE;;;;4CAAA;IAEf,WAAC;AAAD,CAAC,AAJD,IAIC;AAED;IACE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,MAAM,CAAC,UAAU,MAAM,EAAE,WAAoB,EAAE,UAA+B;QAC5E,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC5C,CAAC,CAAA;AACH,CAAC;AAED;IACE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,MAAM,CAAC,UAAU,MAAM,EAAE,WAAoB,EAAE,UAA+B;QAC5E,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC5C,CAAC,CAAA;AACH,CAAC"} -------------------------------------------------------------------------------- /030_decorator_introduction.ts: -------------------------------------------------------------------------------- 1 | class Post { 2 | @processOne() 3 | @processTwo() 4 | someFunction() {} 5 | } 6 | 7 | function processOne() { 8 | console.log("processOne has run"); 9 | return function (target, propertyKey : string, descriptor : PropertyDescriptor) { 10 | console.log("processOne has been called"); 11 | } 12 | } 13 | 14 | function processTwo() { 15 | console.log("processTwo has run"); 16 | return function (target, propertyKey : string, descriptor : PropertyDescriptor) { 17 | console.log("processTwo has been called"); 18 | } 19 | } 20 | 21 | // processOne has run 22 | // processTwo has run 23 | // processTwo has been called 24 | // processOne has been called -------------------------------------------------------------------------------- /031_class_decorator.js: -------------------------------------------------------------------------------- 1 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 2 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 3 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 4 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 5 | return c > 3 && r && Object.defineProperty(target, key, r), r; 6 | }; 7 | var __metadata = (this && this.__metadata) || function (k, v) { 8 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 9 | }; 10 | var AccountsPayable = (function () { 11 | function AccountsPayable() { 12 | } 13 | AccountsPayable = __decorate([ 14 | detailedLog('billing'), 15 | __metadata('design:paramtypes', []) 16 | ], AccountsPayable); 17 | return AccountsPayable; 18 | }()); 19 | var ProductManager = (function () { 20 | function ProductManager() { 21 | } 22 | ProductManager = __decorate([ 23 | detailedLog('warehouse'), 24 | __metadata('design:paramtypes', []) 25 | ], ProductManager); 26 | return ProductManager; 27 | }()); 28 | function detailedLog(dashboard) { 29 | if (dashboard == 'billing') { 30 | console.log('Working in the billing department'); 31 | return function (target) { }; 32 | } 33 | else { 34 | return function (target) { }; 35 | } 36 | } 37 | var post = new AccountsPayable; 38 | var pm = new ProductManager; 39 | //# sourceMappingURL=031_class_decorator.js.map -------------------------------------------------------------------------------- /031_class_decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"031_class_decorator.js","sourceRoot":"","sources":["031_class_decorator.ts"],"names":[],"mappings":";;;;;;;;;AACA;IACC;IAAe,CAAC;IAFjB;QAAC,WAAW,CAAC,SAAS,CAAC;;uBAAA;IAGvB,sBAAC;AAAD,CAAC,AAFD,IAEC;AAGD;IACC;IAAe,CAAC;IAFjB;QAAC,WAAW,CAAC,WAAW,CAAC;;sBAAA;IAGzB,qBAAC;AAAD,CAAC,AAFD,IAEC;AAED,qBAAqB,SAAkB;IACtC,EAAE,CAAA,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,CAAC,UAAU,MAAe,IAAG,CAAC,CAAC;IACtC,CAAC;IAAC,IAAI,CAAC,CAAC;QACP,MAAM,CAAC,UAAU,MAAe,IAAG,CAAC,CAAC;IACtC,CAAC;AACF,CAAC;AAED,IAAI,IAAI,GAAG,IAAI,eAAe,CAAC;AAC/B,IAAI,EAAE,GAAG,IAAI,cAAc,CAAC"} -------------------------------------------------------------------------------- /031_class_decorator.ts: -------------------------------------------------------------------------------- 1 | @detailedLog('billing') 2 | class AccountsPayable { 3 | constructor() {} 4 | } 5 | 6 | @detailedLog('warehouse') 7 | class ProductManager { 8 | constructor() {} 9 | } 10 | 11 | function detailedLog(dashboard : string) { 12 | if(dashboard == 'billing') { 13 | console.log('Working in the billing department'); 14 | return function (target : Object) {}; 15 | } else { 16 | return function (target : Object) {}; 17 | } 18 | } 19 | 20 | var post = new AccountsPayable; 21 | var pm = new ProductManager; 22 | 23 | -------------------------------------------------------------------------------- /032_method_decorator.js: -------------------------------------------------------------------------------- 1 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { 2 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 3 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 4 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 5 | return c > 3 && r && Object.defineProperty(target, key, r), r; 6 | }; 7 | var __metadata = (this && this.__metadata) || function (k, v) { 8 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); 9 | }; 10 | var AccountsPayable = (function () { 11 | function AccountsPayable() { 12 | } 13 | AccountsPayable.prototype.deleteAccount = function () { 14 | console.log('Deleting account...'); 15 | }; 16 | __decorate([ 17 | admin, 18 | __metadata('design:type', Function), 19 | __metadata('design:paramtypes', []), 20 | __metadata('design:returntype', void 0) 21 | ], AccountsPayable.prototype, "deleteAccount", null); 22 | AccountsPayable = __decorate([ 23 | detailedLog('billing'), 24 | __metadata('design:paramtypes', []) 25 | ], AccountsPayable); 26 | return AccountsPayable; 27 | }()); 28 | function detailedLog(dashboard) { 29 | if (dashboard == 'billing') { 30 | console.log('Working in the billing department'); 31 | return function (target) { }; 32 | } 33 | else { 34 | return function (target) { }; 35 | } 36 | } 37 | function admin(target, propertyKey, descriptor) { 38 | console.log("Doing admin check"); 39 | return descriptor; 40 | } 41 | var post = new AccountsPayable; 42 | post.deleteAccount(); 43 | //# sourceMappingURL=032_method_decorator.js.map -------------------------------------------------------------------------------- /032_method_decorator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"032_method_decorator.js","sourceRoot":"","sources":["032_method_decorator.ts"],"names":[],"mappings":";;;;;;;;;AACA;IACC;IAAe,CAAC;IAGhB,uCAAa,GAAb;QACC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACpC,CAAC;IAHD;QAAC,KAAK;;;;wDAAA;IAJP;QAAC,WAAW,CAAC,SAAS,CAAC;;uBAAA;IAQvB,sBAAC;AAAD,CAAC,AAPD,IAOC;AAED,qBAAqB,SAAkB;IACtC,EAAE,CAAA,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,CAAC,UAAU,MAAe,IAAG,CAAC,CAAC;IACtC,CAAC;IAAC,IAAI,CAAC,CAAC;QACP,MAAM,CAAC,UAAU,MAAe,IAAG,CAAC,CAAC;IACtC,CAAC;AACF,CAAC;AAED,eAAe,MAAe,EAAE,WAAoB,EAAE,UAAyC;IAC9F,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,MAAM,CAAC,UAAU,CAAC;AACnB,CAAC;AAED,IAAI,IAAI,GAAG,IAAI,eAAe,CAAC;AAC/B,IAAI,CAAC,aAAa,EAAE,CAAC"} -------------------------------------------------------------------------------- /032_method_decorator.ts: -------------------------------------------------------------------------------- 1 | @detailedLog('billing') 2 | class AccountsPayable { 3 | constructor() {} 4 | 5 | @admin 6 | deleteAccount() { 7 | console.log('Deleting account...'); 8 | } 9 | } 10 | 11 | function detailedLog(dashboard : string) { 12 | if(dashboard == 'billing') { 13 | console.log('Working in the billing department'); 14 | return function (target : Object) {}; 15 | } else { 16 | return function (target : Object) {}; 17 | } 18 | } 19 | 20 | function admin(target : Object, propertyKey : string, descriptor : TypedPropertyDescriptor) : any { 21 | console.log("Doing admin check"); 22 | return descriptor; 23 | } 24 | 25 | var post = new AccountsPayable; 26 | post.deleteAccount(); 27 | 28 | // Doing admin check 29 | // Working in the billing department 30 | // Deleting account... -------------------------------------------------------------------------------- /033_decorator_example_angular.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | export class Hero { 4 | id: number; 5 | name: string; 6 | } 7 | 8 | @Component({ 9 | selector: 'my-app', 10 | template: ` 11 |

{{title}}

12 |

{{hero.name}} details!

13 |
{{hero.id}}
14 |
15 | 16 | 17 |
18 | ` 19 | }) 20 | 21 | export class AppComponent { 22 | title = 'Tour of Heroes'; 23 | hero: Hero = { 24 | id: 1, 25 | name: 'Windstorm' 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TypeScript Introduction 2 | 3 | Source code guides for the devCamp [TypeScript Introduction Course](https://rails.devcamp.com/trails/introduction-typescript) 4 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "amd", 4 | // "target": "es6", // sudo typings install dt~es6-promise dt~es6-collections --global --save 5 | "target": "ES5", 6 | "experimentalDecorators": true, 7 | "emitDecoratorMetadata" : true, 8 | "sourceMap": true 9 | }, 10 | "files": [ 11 | "033_decorator_example_angular.ts" 12 | ] 13 | } -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "globalDependencies": { 3 | "es6-collections": "registry:dt/es6-collections#0.5.1+20160316155526", 4 | "es6-promise": "registry:dt/es6-promise#0.0.0+20160614011821" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /typings/globals/es6-collections/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/es6-collections/es6-collections.d.ts 3 | interface IteratorResult { 4 | done: boolean; 5 | value?: T; 6 | } 7 | 8 | interface Iterator { 9 | next(value?: any): IteratorResult; 10 | return?(value?: any): IteratorResult; 11 | throw?(e?: any): IteratorResult; 12 | } 13 | 14 | interface ForEachable { 15 | forEach(callbackfn: (value: T) => void): void; 16 | } 17 | 18 | interface Map { 19 | clear(): void; 20 | delete(key: K): boolean; 21 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; 22 | get(key: K): V; 23 | has(key: K): boolean; 24 | set(key: K, value?: V): Map; 25 | entries(): Iterator<[K, V]>; 26 | keys(): Iterator; 27 | values(): Iterator; 28 | size: number; 29 | } 30 | 31 | interface MapConstructor { 32 | new (): Map; 33 | new (iterable: ForEachable<[K, V]>): Map; 34 | prototype: Map; 35 | } 36 | 37 | declare var Map: MapConstructor; 38 | 39 | interface Set { 40 | add(value: T): Set; 41 | clear(): void; 42 | delete(value: T): boolean; 43 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; 44 | has(value: T): boolean; 45 | entries(): Iterator<[T, T]>; 46 | keys(): Iterator; 47 | values(): Iterator; 48 | size: number; 49 | } 50 | 51 | interface SetConstructor { 52 | new (): Set; 53 | new (iterable: ForEachable): Set; 54 | prototype: Set; 55 | } 56 | 57 | declare var Set: SetConstructor; 58 | 59 | interface WeakMap { 60 | delete(key: K): boolean; 61 | clear(): void; 62 | get(key: K): V; 63 | has(key: K): boolean; 64 | set(key: K, value?: V): WeakMap; 65 | } 66 | 67 | interface WeakMapConstructor { 68 | new (): WeakMap; 69 | new (iterable: ForEachable<[K, V]>): WeakMap; 70 | prototype: WeakMap; 71 | } 72 | 73 | declare var WeakMap: WeakMapConstructor; 74 | 75 | interface WeakSet { 76 | delete(value: T): boolean; 77 | clear(): void; 78 | add(value: T): WeakSet; 79 | has(value: T): boolean; 80 | } 81 | 82 | interface WeakSetConstructor { 83 | new (): WeakSet; 84 | new (iterable: ForEachable): WeakSet; 85 | prototype: WeakSet; 86 | } 87 | 88 | declare var WeakSet: WeakSetConstructor; 89 | 90 | declare module "es6-collections" { 91 | var Map: MapConstructor; 92 | var Set: SetConstructor; 93 | var WeakMap: WeakMapConstructor; 94 | var WeakSet: WeakSetConstructor; 95 | } 96 | -------------------------------------------------------------------------------- /typings/globals/es6-collections/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/es6-collections/es6-collections.d.ts", 5 | "raw": "registry:dt/es6-collections#0.5.1+20160316155526", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/56295f5058cac7ae458540423c50ac2dcf9fc711/es6-collections/es6-collections.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/es6-promise/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts 3 | interface Thenable { 4 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; 5 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Thenable; 6 | } 7 | 8 | declare class Promise implements Thenable { 9 | /** 10 | * If you call resolve in the body of the callback passed to the constructor, 11 | * your promise is fulfilled with result object passed to resolve. 12 | * If you call reject your promise is rejected with the object passed to reject. 13 | * For consistency and debugging (eg stack traces), obj should be an instanceof Error. 14 | * Any errors thrown in the constructor callback will be implicitly passed to reject(). 15 | */ 16 | constructor(callback: (resolve : (value?: T | Thenable) => void, reject: (error?: any) => void) => void); 17 | 18 | /** 19 | * onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects. 20 | * Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called. 21 | * Both callbacks have a single parameter , the fulfillment value or rejection reason. 22 | * "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve. 23 | * If an error is thrown in the callback, the returned promise rejects with that error. 24 | * 25 | * @param onFulfilled called when/if "promise" resolves 26 | * @param onRejected called when/if "promise" rejects 27 | */ 28 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; 29 | then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => void): Promise; 30 | 31 | /** 32 | * Sugar for promise.then(undefined, onRejected) 33 | * 34 | * @param onRejected called when/if "promise" rejects 35 | */ 36 | catch(onRejected?: (error: any) => U | Thenable): Promise; 37 | } 38 | 39 | declare namespace Promise { 40 | /** 41 | * Make a new promise from the thenable. 42 | * A thenable is promise-like in as far as it has a "then" method. 43 | */ 44 | function resolve(value?: T | Thenable): Promise; 45 | 46 | /** 47 | * Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error 48 | */ 49 | function reject(error: any): Promise; 50 | function reject(error: T): Promise; 51 | 52 | /** 53 | * Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects. 54 | * the array passed to all can be a mixture of promise-like objects and other objects. 55 | * The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value. 56 | */ 57 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable, T10 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; 58 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable, T9 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; 59 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable, T8 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; 60 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable, T7 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; 61 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable, T6 | Thenable]): Promise<[T1, T2, T3, T4, T5, T6]>; 62 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable , T5 | Thenable]): Promise<[T1, T2, T3, T4, T5]>; 63 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable, T4 | Thenable ]): Promise<[T1, T2, T3, T4]>; 64 | function all(values: [T1 | Thenable, T2 | Thenable, T3 | Thenable]): Promise<[T1, T2, T3]>; 65 | function all(values: [T1 | Thenable, T2 | Thenable]): Promise<[T1, T2]>; 66 | function all(values: (T | Thenable)[]): Promise; 67 | 68 | /** 69 | * Make a Promise that fulfills when any item fulfills, and rejects if any item rejects. 70 | */ 71 | function race(promises: (T | Thenable)[]): Promise; 72 | } 73 | 74 | declare module 'es6-promise' { 75 | var foo: typeof Promise; // Temp variable to reference Promise in local context 76 | namespace rsvp { 77 | export var Promise: typeof foo; 78 | export function polyfill(): void; 79 | } 80 | export = rsvp; 81 | } 82 | -------------------------------------------------------------------------------- /typings/globals/es6-promise/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts", 5 | "raw": "registry:dt/es6-promise#0.0.0+20160614011821", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/71c9d2336c0c802f89d530e07563e00b9ac07792/es6-promise/es6-promise.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/globals/es6-shim/index.d.ts: -------------------------------------------------------------------------------- 1 | // Generated by typings 2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts 3 | declare type PropertyKey = string | number | symbol; 4 | 5 | interface IteratorResult { 6 | done: boolean; 7 | value?: T; 8 | } 9 | 10 | interface IterableShim { 11 | /** 12 | * Shim for an ES6 iterable. Not intended for direct use by user code. 13 | */ 14 | "_es6-shim iterator_"(): Iterator; 15 | } 16 | 17 | interface Iterator { 18 | next(value?: any): IteratorResult; 19 | return?(value?: any): IteratorResult; 20 | throw?(e?: any): IteratorResult; 21 | } 22 | 23 | interface IterableIteratorShim extends IterableShim, Iterator { 24 | /** 25 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code. 26 | */ 27 | "_es6-shim iterator_"(): IterableIteratorShim; 28 | } 29 | 30 | interface StringConstructor { 31 | /** 32 | * Return the String value whose elements are, in order, the elements in the List elements. 33 | * If length is 0, the empty string is returned. 34 | */ 35 | fromCodePoint(...codePoints: number[]): string; 36 | 37 | /** 38 | * String.raw is intended for use as a tag function of a Tagged Template String. When called 39 | * as such the first argument will be a well formed template call site object and the rest 40 | * parameter will contain the substitution values. 41 | * @param template A well-formed template string call site representation. 42 | * @param substitutions A set of substitution values. 43 | */ 44 | raw(template: TemplateStringsArray, ...substitutions: any[]): string; 45 | } 46 | 47 | interface String { 48 | /** 49 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point 50 | * value of the UTF-16 encoded code point starting at the string element at position pos in 51 | * the String resulting from converting this object to a String. 52 | * If there is no element at that position, the result is undefined. 53 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. 54 | */ 55 | codePointAt(pos: number): number; 56 | 57 | /** 58 | * Returns true if searchString appears as a substring of the result of converting this 59 | * object to a String, at one or more positions that are 60 | * greater than or equal to position; otherwise, returns false. 61 | * @param searchString search string 62 | * @param position If position is undefined, 0 is assumed, so as to search all of the String. 63 | */ 64 | includes(searchString: string, position?: number): boolean; 65 | 66 | /** 67 | * Returns true if the sequence of elements of searchString converted to a String is the 68 | * same as the corresponding elements of this object (converted to a String) starting at 69 | * endPosition – length(this). Otherwise returns false. 70 | */ 71 | endsWith(searchString: string, endPosition?: number): boolean; 72 | 73 | /** 74 | * Returns a String value that is made from count copies appended together. If count is 0, 75 | * T is the empty String is returned. 76 | * @param count number of copies to append 77 | */ 78 | repeat(count: number): string; 79 | 80 | /** 81 | * Returns true if the sequence of elements of searchString converted to a String is the 82 | * same as the corresponding elements of this object (converted to a String) starting at 83 | * position. Otherwise returns false. 84 | */ 85 | startsWith(searchString: string, position?: number): boolean; 86 | 87 | /** 88 | * Returns an HTML anchor element and sets the name attribute to the text value 89 | * @param name 90 | */ 91 | anchor(name: string): string; 92 | 93 | /** Returns a HTML element */ 94 | big(): string; 95 | 96 | /** Returns a HTML element */ 97 | blink(): string; 98 | 99 | /** Returns a HTML element */ 100 | bold(): string; 101 | 102 | /** Returns a HTML element */ 103 | fixed(): string 104 | 105 | /** Returns a HTML element and sets the color attribute value */ 106 | fontcolor(color: string): string 107 | 108 | /** Returns a HTML element and sets the size attribute value */ 109 | fontsize(size: number): string; 110 | 111 | /** Returns a HTML element and sets the size attribute value */ 112 | fontsize(size: string): string; 113 | 114 | /** Returns an HTML element */ 115 | italics(): string; 116 | 117 | /** Returns an HTML element and sets the href attribute value */ 118 | link(url: string): string; 119 | 120 | /** Returns a HTML element */ 121 | small(): string; 122 | 123 | /** Returns a HTML element */ 124 | strike(): string; 125 | 126 | /** Returns a HTML element */ 127 | sub(): string; 128 | 129 | /** Returns a HTML element */ 130 | sup(): string; 131 | 132 | /** 133 | * Shim for an ES6 iterable. Not intended for direct use by user code. 134 | */ 135 | "_es6-shim iterator_"(): IterableIteratorShim; 136 | } 137 | 138 | interface ArrayConstructor { 139 | /** 140 | * Creates an array from an array-like object. 141 | * @param arrayLike An array-like object to convert to an array. 142 | * @param mapfn A mapping function to call on every element of the array. 143 | * @param thisArg Value of 'this' used to invoke the mapfn. 144 | */ 145 | from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 146 | 147 | /** 148 | * Creates an array from an iterable object. 149 | * @param iterable An iterable object to convert to an array. 150 | * @param mapfn A mapping function to call on every element of the array. 151 | * @param thisArg Value of 'this' used to invoke the mapfn. 152 | */ 153 | from(iterable: IterableShim, mapfn: (v: T, k: number) => U, thisArg?: any): Array; 154 | 155 | /** 156 | * Creates an array from an array-like object. 157 | * @param arrayLike An array-like object to convert to an array. 158 | */ 159 | from(arrayLike: ArrayLike): Array; 160 | 161 | /** 162 | * Creates an array from an iterable object. 163 | * @param iterable An iterable object to convert to an array. 164 | */ 165 | from(iterable: IterableShim): Array; 166 | 167 | /** 168 | * Returns a new array from a set of elements. 169 | * @param items A set of elements to include in the new array object. 170 | */ 171 | of(...items: T[]): Array; 172 | } 173 | 174 | interface Array { 175 | /** 176 | * Returns the value of the first element in the array where predicate is true, and undefined 177 | * otherwise. 178 | * @param predicate find calls predicate once for each element of the array, in ascending 179 | * order, until it finds one where predicate returns true. If such an element is found, find 180 | * immediately returns that element value. Otherwise, find returns undefined. 181 | * @param thisArg If provided, it will be used as the this value for each invocation of 182 | * predicate. If it is not provided, undefined is used instead. 183 | */ 184 | find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; 185 | 186 | /** 187 | * Returns the index of the first element in the array where predicate is true, and undefined 188 | * otherwise. 189 | * @param predicate find calls predicate once for each element of the array, in ascending 190 | * order, until it finds one where predicate returns true. If such an element is found, find 191 | * immediately returns that element value. Otherwise, find returns undefined. 192 | * @param thisArg If provided, it will be used as the this value for each invocation of 193 | * predicate. If it is not provided, undefined is used instead. 194 | */ 195 | findIndex(predicate: (value: T) => boolean, thisArg?: any): number; 196 | 197 | /** 198 | * Returns the this object after filling the section identified by start and end with value 199 | * @param value value to fill array section with 200 | * @param start index to start filling the array at. If start is negative, it is treated as 201 | * length+start where length is the length of the array. 202 | * @param end index to stop filling the array at. If end is negative, it is treated as 203 | * length+end. 204 | */ 205 | fill(value: T, start?: number, end?: number): T[]; 206 | 207 | /** 208 | * Returns the this object after copying a section of the array identified by start and end 209 | * to the same array starting at position target 210 | * @param target If target is negative, it is treated as length+target where length is the 211 | * length of the array. 212 | * @param start If start is negative, it is treated as length+start. If end is negative, it 213 | * is treated as length+end. 214 | * @param end If not specified, length of the this object is used as its default value. 215 | */ 216 | copyWithin(target: number, start: number, end?: number): T[]; 217 | 218 | /** 219 | * Returns an array of key, value pairs for every entry in the array 220 | */ 221 | entries(): IterableIteratorShim<[number, T]>; 222 | 223 | /** 224 | * Returns an list of keys in the array 225 | */ 226 | keys(): IterableIteratorShim; 227 | 228 | /** 229 | * Returns an list of values in the array 230 | */ 231 | values(): IterableIteratorShim; 232 | 233 | /** 234 | * Shim for an ES6 iterable. Not intended for direct use by user code. 235 | */ 236 | "_es6-shim iterator_"(): IterableIteratorShim; 237 | } 238 | 239 | interface NumberConstructor { 240 | /** 241 | * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 242 | * that is representable as a Number value, which is approximately: 243 | * 2.2204460492503130808472633361816 x 10‍−‍16. 244 | */ 245 | EPSILON: number; 246 | 247 | /** 248 | * Returns true if passed value is finite. 249 | * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a 250 | * number. Only finite values of the type number, result in true. 251 | * @param number A numeric value. 252 | */ 253 | isFinite(number: number): boolean; 254 | 255 | /** 256 | * Returns true if the value passed is an integer, false otherwise. 257 | * @param number A numeric value. 258 | */ 259 | isInteger(number: number): boolean; 260 | 261 | /** 262 | * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a 263 | * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter 264 | * to a number. Only values of the type number, that are also NaN, result in true. 265 | * @param number A numeric value. 266 | */ 267 | isNaN(number: number): boolean; 268 | 269 | /** 270 | * Returns true if the value passed is a safe integer. 271 | * @param number A numeric value. 272 | */ 273 | isSafeInteger(number: number): boolean; 274 | 275 | /** 276 | * The value of the largest integer n such that n and n + 1 are both exactly representable as 277 | * a Number value. 278 | * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. 279 | */ 280 | MAX_SAFE_INTEGER: number; 281 | 282 | /** 283 | * The value of the smallest integer n such that n and n − 1 are both exactly representable as 284 | * a Number value. 285 | * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). 286 | */ 287 | MIN_SAFE_INTEGER: number; 288 | 289 | /** 290 | * Converts a string to a floating-point number. 291 | * @param string A string that contains a floating-point number. 292 | */ 293 | parseFloat(string: string): number; 294 | 295 | /** 296 | * Converts A string to an integer. 297 | * @param s A string to convert into a number. 298 | * @param radix A value between 2 and 36 that specifies the base of the number in numString. 299 | * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. 300 | * All other strings are considered decimal. 301 | */ 302 | parseInt(string: string, radix?: number): number; 303 | } 304 | 305 | interface ObjectConstructor { 306 | /** 307 | * Copy the values of all of the enumerable own properties from one or more source objects to a 308 | * target object. Returns the target object. 309 | * @param target The target object to copy to. 310 | * @param sources One or more source objects to copy properties from. 311 | */ 312 | assign(target: any, ...sources: any[]): any; 313 | 314 | /** 315 | * Returns true if the values are the same value, false otherwise. 316 | * @param value1 The first value. 317 | * @param value2 The second value. 318 | */ 319 | is(value1: any, value2: any): boolean; 320 | 321 | /** 322 | * Sets the prototype of a specified object o to object proto or null. Returns the object o. 323 | * @param o The object to change its prototype. 324 | * @param proto The value of the new prototype or null. 325 | * @remarks Requires `__proto__` support. 326 | */ 327 | setPrototypeOf(o: any, proto: any): any; 328 | } 329 | 330 | interface RegExp { 331 | /** 332 | * Returns a string indicating the flags of the regular expression in question. This field is read-only. 333 | * The characters in this string are sequenced and concatenated in the following order: 334 | * 335 | * - "g" for global 336 | * - "i" for ignoreCase 337 | * - "m" for multiline 338 | * - "u" for unicode 339 | * - "y" for sticky 340 | * 341 | * If no flags are set, the value is the empty string. 342 | */ 343 | flags: string; 344 | } 345 | 346 | interface Math { 347 | /** 348 | * Returns the number of leading zero bits in the 32-bit binary representation of a number. 349 | * @param x A numeric expression. 350 | */ 351 | clz32(x: number): number; 352 | 353 | /** 354 | * Returns the result of 32-bit multiplication of two numbers. 355 | * @param x First number 356 | * @param y Second number 357 | */ 358 | imul(x: number, y: number): number; 359 | 360 | /** 361 | * Returns the sign of the x, indicating whether x is positive, negative or zero. 362 | * @param x The numeric expression to test 363 | */ 364 | sign(x: number): number; 365 | 366 | /** 367 | * Returns the base 10 logarithm of a number. 368 | * @param x A numeric expression. 369 | */ 370 | log10(x: number): number; 371 | 372 | /** 373 | * Returns the base 2 logarithm of a number. 374 | * @param x A numeric expression. 375 | */ 376 | log2(x: number): number; 377 | 378 | /** 379 | * Returns the natural logarithm of 1 + x. 380 | * @param x A numeric expression. 381 | */ 382 | log1p(x: number): number; 383 | 384 | /** 385 | * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of 386 | * the natural logarithms). 387 | * @param x A numeric expression. 388 | */ 389 | expm1(x: number): number; 390 | 391 | /** 392 | * Returns the hyperbolic cosine of a number. 393 | * @param x A numeric expression that contains an angle measured in radians. 394 | */ 395 | cosh(x: number): number; 396 | 397 | /** 398 | * Returns the hyperbolic sine of a number. 399 | * @param x A numeric expression that contains an angle measured in radians. 400 | */ 401 | sinh(x: number): number; 402 | 403 | /** 404 | * Returns the hyperbolic tangent of a number. 405 | * @param x A numeric expression that contains an angle measured in radians. 406 | */ 407 | tanh(x: number): number; 408 | 409 | /** 410 | * Returns the inverse hyperbolic cosine of a number. 411 | * @param x A numeric expression that contains an angle measured in radians. 412 | */ 413 | acosh(x: number): number; 414 | 415 | /** 416 | * Returns the inverse hyperbolic sine of a number. 417 | * @param x A numeric expression that contains an angle measured in radians. 418 | */ 419 | asinh(x: number): number; 420 | 421 | /** 422 | * Returns the inverse hyperbolic tangent of a number. 423 | * @param x A numeric expression that contains an angle measured in radians. 424 | */ 425 | atanh(x: number): number; 426 | 427 | /** 428 | * Returns the square root of the sum of squares of its arguments. 429 | * @param values Values to compute the square root for. 430 | * If no arguments are passed, the result is +0. 431 | * If there is only one argument, the result is the absolute value. 432 | * If any argument is +Infinity or -Infinity, the result is +Infinity. 433 | * If any argument is NaN, the result is NaN. 434 | * If all arguments are either +0 or −0, the result is +0. 435 | */ 436 | hypot(...values: number[]): number; 437 | 438 | /** 439 | * Returns the integral part of the a numeric expression, x, removing any fractional digits. 440 | * If x is already an integer, the result is x. 441 | * @param x A numeric expression. 442 | */ 443 | trunc(x: number): number; 444 | 445 | /** 446 | * Returns the nearest single precision float representation of a number. 447 | * @param x A numeric expression. 448 | */ 449 | fround(x: number): number; 450 | 451 | /** 452 | * Returns an implementation-dependent approximation to the cube root of number. 453 | * @param x A numeric expression. 454 | */ 455 | cbrt(x: number): number; 456 | } 457 | 458 | interface PromiseLike { 459 | /** 460 | * Attaches callbacks for the resolution and/or rejection of the Promise. 461 | * @param onfulfilled The callback to execute when the Promise is resolved. 462 | * @param onrejected The callback to execute when the Promise is rejected. 463 | * @returns A Promise for the completion of which ever callback is executed. 464 | */ 465 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; 466 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; 467 | } 468 | 469 | /** 470 | * Represents the completion of an asynchronous operation 471 | */ 472 | interface Promise { 473 | /** 474 | * Attaches callbacks for the resolution and/or rejection of the Promise. 475 | * @param onfulfilled The callback to execute when the Promise is resolved. 476 | * @param onrejected The callback to execute when the Promise is rejected. 477 | * @returns A Promise for the completion of which ever callback is executed. 478 | */ 479 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; 480 | then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; 481 | 482 | /** 483 | * Attaches a callback for only the rejection of the Promise. 484 | * @param onrejected The callback to execute when the Promise is rejected. 485 | * @returns A Promise for the completion of the callback. 486 | */ 487 | catch(onrejected?: (reason: any) => T | PromiseLike): Promise; 488 | catch(onrejected?: (reason: any) => void): Promise; 489 | } 490 | 491 | interface PromiseConstructor { 492 | /** 493 | * A reference to the prototype. 494 | */ 495 | prototype: Promise; 496 | 497 | /** 498 | * Creates a new Promise. 499 | * @param executor A callback used to initialize the promise. This callback is passed two arguments: 500 | * a resolve callback used resolve the promise with a value or the result of another promise, 501 | * and a reject callback used to reject the promise with a provided reason or error. 502 | */ 503 | new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; 504 | 505 | /** 506 | * Creates a Promise that is resolved with an array of results when all of the provided Promises 507 | * resolve, or rejected when any Promise is rejected. 508 | * @param values An array of Promises. 509 | * @returns A new Promise. 510 | */ 511 | all(values: IterableShim>): Promise; 512 | 513 | /** 514 | * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved 515 | * or rejected. 516 | * @param values An array of Promises. 517 | * @returns A new Promise. 518 | */ 519 | race(values: IterableShim>): Promise; 520 | 521 | /** 522 | * Creates a new rejected promise for the provided reason. 523 | * @param reason The reason the promise was rejected. 524 | * @returns A new rejected Promise. 525 | */ 526 | reject(reason: any): Promise; 527 | 528 | /** 529 | * Creates a new rejected promise for the provided reason. 530 | * @param reason The reason the promise was rejected. 531 | * @returns A new rejected Promise. 532 | */ 533 | reject(reason: any): Promise; 534 | 535 | /** 536 | * Creates a new resolved promise for the provided value. 537 | * @param value A promise. 538 | * @returns A promise whose internal state matches the provided promise. 539 | */ 540 | resolve(value: T | PromiseLike): Promise; 541 | 542 | /** 543 | * Creates a new resolved promise . 544 | * @returns A resolved promise. 545 | */ 546 | resolve(): Promise; 547 | } 548 | 549 | declare var Promise: PromiseConstructor; 550 | 551 | interface Map { 552 | clear(): void; 553 | delete(key: K): boolean; 554 | forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; 555 | get(key: K): V; 556 | has(key: K): boolean; 557 | set(key: K, value?: V): Map; 558 | size: number; 559 | entries(): IterableIteratorShim<[K, V]>; 560 | keys(): IterableIteratorShim; 561 | values(): IterableIteratorShim; 562 | } 563 | 564 | interface MapConstructor { 565 | new (): Map; 566 | new (iterable: IterableShim<[K, V]>): Map; 567 | prototype: Map; 568 | } 569 | 570 | declare var Map: MapConstructor; 571 | 572 | interface Set { 573 | add(value: T): Set; 574 | clear(): void; 575 | delete(value: T): boolean; 576 | forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; 577 | has(value: T): boolean; 578 | size: number; 579 | entries(): IterableIteratorShim<[T, T]>; 580 | keys(): IterableIteratorShim; 581 | values(): IterableIteratorShim; 582 | '_es6-shim iterator_'(): IterableIteratorShim; 583 | } 584 | 585 | interface SetConstructor { 586 | new (): Set; 587 | new (iterable: IterableShim): Set; 588 | prototype: Set; 589 | } 590 | 591 | declare var Set: SetConstructor; 592 | 593 | interface WeakMap { 594 | delete(key: K): boolean; 595 | get(key: K): V; 596 | has(key: K): boolean; 597 | set(key: K, value?: V): WeakMap; 598 | } 599 | 600 | interface WeakMapConstructor { 601 | new (): WeakMap; 602 | new (iterable: IterableShim<[K, V]>): WeakMap; 603 | prototype: WeakMap; 604 | } 605 | 606 | declare var WeakMap: WeakMapConstructor; 607 | 608 | interface WeakSet { 609 | add(value: T): WeakSet; 610 | delete(value: T): boolean; 611 | has(value: T): boolean; 612 | } 613 | 614 | interface WeakSetConstructor { 615 | new (): WeakSet; 616 | new (iterable: IterableShim): WeakSet; 617 | prototype: WeakSet; 618 | } 619 | 620 | declare var WeakSet: WeakSetConstructor; 621 | 622 | declare namespace Reflect { 623 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 624 | function construct(target: Function, argumentsList: ArrayLike): any; 625 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 626 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 627 | function enumerate(target: any): IterableIteratorShim; 628 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 629 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 630 | function getPrototypeOf(target: any): any; 631 | function has(target: any, propertyKey: PropertyKey): boolean; 632 | function isExtensible(target: any): boolean; 633 | function ownKeys(target: any): Array; 634 | function preventExtensions(target: any): boolean; 635 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 636 | function setPrototypeOf(target: any, proto: any): boolean; 637 | } 638 | 639 | declare module "es6-shim" { 640 | var String: StringConstructor; 641 | var Array: ArrayConstructor; 642 | var Number: NumberConstructor; 643 | var Math: Math; 644 | var Object: ObjectConstructor; 645 | var Map: MapConstructor; 646 | var Set: SetConstructor; 647 | var WeakMap: WeakMapConstructor; 648 | var WeakSet: WeakSetConstructor; 649 | var Promise: PromiseConstructor; 650 | namespace Reflect { 651 | function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; 652 | function construct(target: Function, argumentsList: ArrayLike): any; 653 | function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; 654 | function deleteProperty(target: any, propertyKey: PropertyKey): boolean; 655 | function enumerate(target: any): Iterator; 656 | function get(target: any, propertyKey: PropertyKey, receiver?: any): any; 657 | function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; 658 | function getPrototypeOf(target: any): any; 659 | function has(target: any, propertyKey: PropertyKey): boolean; 660 | function isExtensible(target: any): boolean; 661 | function ownKeys(target: any): Array; 662 | function preventExtensions(target: any): boolean; 663 | function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean; 664 | function setPrototypeOf(target: any, proto: any): boolean; 665 | } 666 | } 667 | -------------------------------------------------------------------------------- /typings/globals/es6-shim/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts", 5 | "raw": "registry:dt/es6-shim#0.31.2+20160602141504", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /typings/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | --------------------------------------------------------------------------------