Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
魏银鹏 committed Nov 8, 2019
1 parent 0ae14d7 commit 49e2d4d
Show file tree
Hide file tree
Showing 40 changed files with 15,849 additions and 273 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ webpack、eslint需要全局npm安装
vue的ts支持暂时用

vue-property-decorator,因为ts对vue的this识别很困难,后期vue+ts兼容较好时可以废弃vue-property-decorator
重要强调:
ts里的`target:'es5'`会把ts文件里的es6编译成es5,也会把vue单文件中的`lang="ts"`编译成es5
但是如果vue里用script用普通es6,则需要babel来支持,不然vue里的es6还是es6.

11. react-webpack-eslint-typescript

Expand Down
2 changes: 1 addition & 1 deletion react-webpack-eslint-typescript/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class App extends React.Component<HelloProps> {
render () {
const {compiler, framework} = this.props;
return (
<div>hello, world, compiler is {compiler}, framework is {framework}</div>
<div>hello, world, 1111compiler is {compiler}, framework is {framework}</div>
)
}
}
2 changes: 2 additions & 0 deletions typescript/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"use strict";
/// <reference path="index.ts" />
6 changes: 6 additions & 0 deletions typescript/a.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference path="index.ts" />
namespace V{
export interface AA{
a:string
}
}
18 changes: 3 additions & 15 deletions typescript/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
"use strict";
var Color;
(function (Color) {
Color[Color["Red"] = 0] = "Red";
Color[Color["Pink"] = 1] = "Pink";
Color[Color["Green"] = 2] = "Green";
})(Color || (Color = {}));
console.log(Color);
for (var item in Color) {
if (isNaN(Number(item))) {
console.log(item);
var dom = document.createElement('p');
dom.innerText = item;
document.body.appendChild(dom);
}
}
var aa = {
a: '2'
};
11 changes: 2 additions & 9 deletions typescript/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
enum Color {Red, Pink, Green}
console.log(Color)
for (let item in Color) {
if (isNaN(Number(item))) {
console.log(item);
const dom = document.createElement('p')
dom.innerText = item;
document.body.appendChild(dom)
}
const aa :V.AA = {
a:'2'
}
3 changes: 3 additions & 0 deletions typescript/types/b.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface StringValidator {
isAccept(s:string):boolean
}
2 changes: 1 addition & 1 deletion vue-webpack-eslint-typescript/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>single-file-components</title>
</head>
<body>
<div id="app">{{value}}</div>
<div id="app"></div>
<script src="./dist/main.js"></script>
</body>
</html>
186 changes: 184 additions & 2 deletions vue-webpack-eslint-typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 49e2d4d

Please sign in to comment.