File tree Expand file tree Collapse file tree 3 files changed +34
-5
lines changed
typescript-essential-training Expand file tree Collapse file tree 3 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 1212 "author" : " Stiven Ramírez Arango" ,
1313 "license" : " ISC" ,
1414 "devDependencies" : {
15- "typescript" : " ^4.8.3" ,
16- "ts-node" : " ^10.9.1" ,
17- "nodemon" : " ^2.0.19" ,
15+ "@types/jquery" : " ^3.5.14" ,
1816 "@types/node" : " ^18.7.21" ,
1917 "@typescript-eslint/eslint-plugin" : " ^5.36.1" ,
2018 "@typescript-eslint/parser" : " ^5.36.1" ,
2119 "eslint" : " ^8.23.0" ,
2220 "eslint-config-prettier" : " ^8.5.0" ,
2321 "eslint-plugin-prettier" : " ^4.2.1" ,
24- "prettier" : " ^2.7.1"
22+ "nodemon" : " ^2.0.19" ,
23+ "prettier" : " ^2.7.1" ,
24+ "ts-node" : " ^10.9.1" ,
25+ "typescript" : " ^4.8.3"
2526 }
2627}
Original file line number Diff line number Diff line change 1+ /**
2+ *
3+ * @param {number } contactId
4+ * @returns
5+ */
6+ async function getContact ( contactId ) {
7+ const resp = await $ . ajax ( {
8+ url : `/contacts/${ contactId } ` ,
9+ dataType : 'json' ,
10+ } ) ;
11+
12+ return {
13+ id : + resp . id ,
14+ name : resp . name ,
15+ birthDate : new Date ( resp . birthDate ) ,
16+ } ;
17+ }
18+
19+ getContact ( 1 ) . then ( ( contact ) => {
20+ contact . id = 1234 ;
21+ contact . birthDate = new Date ( '12/12/1990' ) ;
22+ } ) ;
23+
24+ getContact ( 2 ) . then ( ( contact ) => {
25+ console . log ( 'Contact: ' , JSON . stringify ( contact ) ) ;
26+ } ) ;
Original file line number Diff line number Diff line change 22 "compilerOptions" : {
33 "outDir" : " dist" ,
44 "target" : " ES6" ,
5- "noEmit" : true
5+ "noEmit" : true ,
6+ "allowJs" : true ,
7+ "checkJs" : true
68 },
79 "include" : [" src/**/*" , " index.ts" ]
810}
You can’t perform that action at this time.
0 commit comments