简体   繁体   English

tslint rxjs-tslint-rules在编译的程序中找不到'/users/whisher/projects/my/src/rxjs-imports.ts'。 它是进口的吗?

[英]tslint rxjs-tslint-rules Cannot find '/users/whisher/projects/my/src/rxjs-imports.ts' in the compiled program. Has it been imported?

I've add this linter rxjs-tslint-rules to my tslint.json like 我已经将这个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"
  },

and of course I've add in the src folder the rxjs-imports.ts file 当然,我已经在src文件夹中添加了rxjs-imports.ts文件

import 'rxjs/add/operator/map';

than in my main.ts 比我的main.ts

import './rxjs-imports';

but I get 但我明白了

Cannot find '/users/whisher/projects/my/src/rxjs-imports.ts' in the compiled program. 在已编译的程序中找不到“ /users/whisher/projects/my/src/rxjs-imports.ts”。 Has it been imported? 它是进口的吗?

How can I fix it ? 我该如何解决?

or is it a bug ? 还是一个错误?

UPDATE UPDATE

I've seen just now with the brand new 5.5 version there are lettable operators so the rxjs-imports file now is quite useless. 我刚刚看到全新的5.5版本具有可操作的运算符,因此rxjs-imports文件现在非常无用。

https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md https://github.com/ReactiveX/rxjs/blob/master/doc/lettable-operators.md

Adding 添加

"files": [
  "../src/rxjs-imports.ts"
]

to tsconfig.e2e.json fixed it for me. tsconfig.e2e.json为我修复了它。

Full config is as follows: 完整配置如下:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../dist/out-tsc/e2e",
    "baseUrl": "./",
    "module": "commonjs",
    "target": "es5",
    "types": [
      "jasmine",
      "jasminewd2",
      "node"
    ]
  },
  "files": [
    "../src/rxjs-imports.ts"
  ]
}

and tsconfig.json is: 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"
    ]
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM