Skip to content

Commit 2634a94

Browse files
committed
setup TypeScript
1 parent 7119097 commit 2634a94

File tree

7 files changed

+816
-30
lines changed

7 files changed

+816
-30
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
presets: [
3+
['@babel/preset-env', {targets: {node: 'current'}}],
4+
'@babel/preset-typescript',
5+
],
6+
};

examples/typescript/ts-step_shotgun_surgery-01_base/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"test": "jest"
88
},
99
"devDependencies": {
10-
"jest": "^26.6.3"
10+
"@babel/core": "^7.13.15",
11+
"@babel/preset-env": "^7.13.15",
12+
"@babel/preset-typescript": "^7.13.0",
13+
"@types/jest": "^26.0.22",
14+
"babel-jest": "^26.6.3",
15+
"jest": "^26.6.3",
16+
"typescript": "^4.2.4"
1117
}
1218
}

examples/typescript/ts-step_shotgun_surgery-01_base/src/index.js

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
interface Course {
2+
title: string;
3+
}
4+
5+
function courseTitle(course: Course) {
6+
return course.title;
7+
}
8+
9+
module.exports = courseTitle;

examples/typescript/ts-step_shotgun_surgery-01_base/tests/index.test.js

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const courseTitle = require('../src');
2+
3+
test('gets the course title', () => {
4+
const course = {title: 'Refactoring'}
5+
expect(courseTitle(course)).toBe('Refactoring')
6+
});

examples/typescript/ts-step_shotgun_surgery-01_base/yarn.lock

Lines changed: 788 additions & 19 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)