-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RxJS 6 requires "dom" lib when using TypeScript #3558
Comments
This is down to having all of the factory functions - including The distribution now relies upon a bundler to 'tree-shake' any unused exports. However, TypeScript will still see all of the exports - whether used or not. That means that when using RxJS v6 in a Node application, it's still necessary to include TypeScript's This has the unfortunate effect of introducing a whole bunch of type and global declarations that are not appropriate for a Node target. In v5, the Maybe there's not too much that can be done about this - short of removing the dependency on the |
You could ship two sets of {
"compilerOptions": {
"baseUrl": ".",
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"strict": true,
"paths": {
"rxjs": ["node_modules/rxjs/node/index.d.ts"]
},
"lib": [
"es2015"
]
},
"files": [
"index.ts"
]
}
|
You can also add the option This could be even more obvious if, for instance, a library you depend on had looser compilation flags than your project. Say the library had Therefore you should typically be using |
Adds interfaces to cover what is used from DOM in `fromEvent` so that types are carried through, but `dom` lib isn not required by default even if you are not using `fromEvent` fixes: ReactiveX#3558
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RxJS version: 6.0.0-beta.4
Code to reproduce:
index.ts
tsconfig.json
Expected behavior: Successful compilation.
Actual behavior: Without
"dom"
in"lib"
, the following compilation error occurs:The text was updated successfully, but these errors were encountered: