Skip to content

Commit 133b609

Browse files
[IMP] Allow JS
1 parent 59fa60f commit 133b609

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

typescript-essential-training/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
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
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
});

typescript-essential-training/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
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
}

0 commit comments

Comments
 (0)