我添加了这个 linter rxjs-tslint-rules到我的 tslint.json 喜欢
"extends": [
"rxjs-tslint-rules"
],
"rules": {
"rxjs-add": {
"options": [{
"allowElsewhere": false,
"allowUnused": false,
"file": "./src/rxjs-imports.ts"
}],
"severity": "error"
},
当然,我已经添加了src文件夹rxjs-imports.ts 文件
import 'rxjs/add/operator/map';
比在我的主
import './rxjs-imports';
但我得到
在编译的程序中找不到'/users/whisher/projects/my/src/rxjs-imports.ts'。它被进口了吗?
我该如何解决?
还是错误?
更新
我刚才看到了全新的5.5版本有可出租运算符,因此 RXJS 导入文件现在很没用。
https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md
添加
"files": [
"../src/rxjs-imports.ts"
]
tsconfig.e2e.json
为我修复了它。
完整配置如下:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../dist/out-tsc/e2e",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
},
"files": [
"../src/rxjs-imports.ts"
]
}
tsconfig.json
是:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}