Open zuoyanart opened 6 years ago
typescript 编译时没有类型检测
OS Platform: win7, centos
Node.js Version: 8.9.1 ThinkJS Version: think-cli 2.2.1
thinkjs new xxx typescript
import Base from './base.js'; export default class extends Base { indexAction() { let a: number = 'a'; return this.display(); } }
[2018-02-01T10:50:19.740] [17192] [INFO] - transpile file controller\index.ts success [2018-02-01T10:50:21.201] [17192] [INFO] - transpile file controller\index.ts success
tsc src\controller\index.ts src/controller/index.ts(4,13): error TS2322: Type '"a"' is not assignable to type 'number'. src/controller/index.ts(5,21): error TS2339: Property 'display' does not exist on type 'default'.
检查一下你的 development.js 里面的transpiler 的配置,看看和你的 tsconfig.json 的配置是否一致。@zuoyanart
DESC
typescript 编译时没有类型检测
ENV
OS Platform: win7, centos
Node.js Version: 8.9.1 ThinkJS Version: think-cli 2.2.1
code
创建命令
js代码,controller/index.ts
编译
tsc编译