Skip to content

Commit

Permalink
add ts
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Dec 17, 2023
1 parent 8e6f1fb commit 4c6a966
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mock/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import './branch.js';
import './typescript.ts';

import '../minify/comments.js';
import '../minify/demo.js';

Expand Down
29 changes: 29 additions & 0 deletions mock/src/typescript.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var str: string = "hello world";

// point type
type Point = {
x: number,
y: number
}

var p: Point = {
x: 1,
y: 2
}

var fun = (v: Point) => {
console.log(v);
}

fun(p);

var main = (p: Point, v: string) => {
/*
block comment
*/

console.log(p, v);

}

module.exports = main;
3 changes: 3 additions & 0 deletions mock/webpack.config-istanbul.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ module.exports = {
]
}
}
}, {
test: /\.tsx?$/,
use: 'ts-loader'
}]
}
};
3 changes: 3 additions & 0 deletions mock/webpack.config-v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = {
use: {
loader: 'babel-loader'
}
}, {
test: /\.tsx?$/,
use: 'ts-loader'
}]
}
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
"playwright": "^1.40.1",
"stylelint": "^15.11.0",
"stylelint-config-plus": "^1.0.4",
"ts-loader": "^9.5.1",
"typescript": "^5.3.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
}
}
5 changes: 5 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"sourceMap": true
}
}

0 comments on commit 4c6a966

Please sign in to comment.