Skip to content
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

Bump up typescript to latest #3009

Merged
merged 4 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .dependency-cruiser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"forbidden": [
{
"name": "not-to-spec",
"comment": "Don't allow dependencies from outside the spec folder to spec",
"severity": "error",
"from": {
"pathNot": "^spec"
},
"to": {
"path": "^spec"
}
},
{
"name": "not-to-spec",
"comment": "Don't allow dependencies to (typescript/ javascript/ coffeescript) spec files",
"severity": "error",
"from": {},
"to": {
"path": "\\.spec\\.[js|ts|ls|coffee|litcoffee|coffee\\.md]$"
}
},
{
"name": "no-deprecated-core",
"comment": "Warn about dependencies on deprecated core modules.",
"severity": "warn",
"from": {},
"to": {
"dependencyTypes": [
"core"
],
"path": "^(punycode|domain)$"
}
},
{
"name": "no-deprecated-npm",
"comment": "These npm modules are deprecated - find an alternative.",
"severity": "warn",
"from": {},
"to": {
"dependencyTypes": [
"deprecated"
]
}
},
{
"name": "not-to-dev-dep",
"severity": "error",
"comment": "Don't allow dependencies from src/app/lib to a development only package",
"from": {
"path": "^(src|app|lib)"
},
"to": {
"dependencyTypes": [
"npm-dev"
]
}
},
{
"name": "no-non-package-json",
"severity": "error",
"comment": "Don't allow dependencies to packages not in package.json (except from within node_modules)",
"from": {
"pathNot": "^node_modules"
},
"to": {
"dependencyTypes": [
"undetermined",
"npm-no-pkg",
"npm-unknown"
],
"pathNot": "^electron"
}
},
{
"name": "peer-deps-used",
"comment": "Error about the use of a peer dependency (peer dependencies are deprecated).",
"severity": "error",
"from": {},
"to": {
"dependencyTypes": [
"npm-peer"
]
}
},
{
"name": "no-duplicate-dep-types",
"comment": "Warn if a dependency occurs in your package.json more than once (technically: has more than one dependency type)",
"severity": "warn",
"from": {},
"to": {
"moreThanOneDependencyType": true
}
},
{
"name": "no-circular",
"severity": "error",
"comment": "Error in case we have circular dependencies",
"from": {
"path": "^src"
},
"to": {
"circular": true
}
}
]
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ before_install:

install:
- npm install
- if [ "$FULL_VALIDATE" == "true" ]; then npm run lint && npm run check_circular_dependencies; fi
- if [ "$FULL_VALIDATE" == "true" ]; then npm run lint && npm run test:circular; fi

script:
- if [ "$FULL_VALIDATE" == "true" ] && [ -n "DANGER_GITHUB_API_TOKEN" ]; then echo {} > ./.babelrc && npx danger; fi
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"exclude": [
"node_modules",
"dist",
"typings",
"*.d.ts",
"src/**/MiscJSDoc.ts"
],
Expand Down Expand Up @@ -52,7 +51,6 @@
"build_perf": "Build CJS & Global build, run macro performance test",
"build_test": "Build CJS package & test spec, execute mocha test runner",
"build_docs": "Build ESM2015 & global package, create documentation using it",
"check_circular_dependencies": "Check codebase has circular dependencies",
"clean_dist_cjs": "Clean up existing CJS package output",
"clean_dist_esm5": "Clean up existing ESM/ES5 package output",
"clean_dist_esm2015": "Clean up existing ESM/ES2015 package output",
Expand Down Expand Up @@ -90,7 +88,6 @@
"build_perf": "webdriver-manager update && npm-run-all build_cjs build_global perf",
"build_docs": "npm-run-all build_global build_esm2015_for_docs build_cjs tests2png decision_tree_widget && esdoc -c esdoc.json && npm-run-all clean_dist_esm2015",
"build_spec_browser": "webpack --config spec/support/webpack.mocha.config.js",
"check_circular_dependencies": "madge ./dist/cjs --circular",
"clean_dist": "shx rm -rf ./dist",
"clean_dist_cjs": "shx rm -rf ./dist/cjs",
"clean_dist_esm5": "shx rm -rf ./dist/esm5",
Expand All @@ -113,11 +110,12 @@
"lint": "npm-run-all --parallel lint_*",
"perf": "protractor protractor.conf.js",
"perf_micro": "node ./perf/micro/index.js",
"prepublish": "shx rm -rf ./typings && typings install && npm run build_all",
"prepublish": "shx rm -rf ./typings && npm run build_all",
"publish_docs": "./publish_docs.sh",
"test_browser": "npm-run-all build_spec_browser && opn spec/support/mocha-browser-runner.html",
"test": "cross-env TS_NODE_FAST=true mocha --compilers ts:ts-node/register --opts spec/support/coverage.opts \"spec/**/*-spec.ts\"",
"test:cover": "cross-env TS_NODE_FAST=true nyc npm test",
"test:circular": "dependency-cruise --validate .dependency-cruiser.json -x \"^node_modules\" src",
"tests2png": "tsc && mkdirp tmp/docs/img && mkdirp spec-js/support && shx cp spec/support/*.opts spec-js/support/ && mocha --opts spec/support/tests2png.opts spec-js",
"watch": "watch \"echo triggering build && npm run build_test && echo build completed\" src -d -u -w=15"
},
Expand Down Expand Up @@ -171,6 +169,12 @@
"homepage": "https://github.com/ReactiveX/RxJS",
"devDependencies": {
"@angular-devkit/build-optimizer": "0.0.24",
"@types/chai": "^4.0.4",
"@types/lodash": "^4.14.80",
"@types/mocha": "^2.2.44",
"@types/node": "^8.0.47",
"@types/sinon": "^2.3.7",
"@types/sinon-chai": "^2.7.29",
"babel-polyfill": "^6.23.0",
"benchmark": "^2.1.0",
"benchpress": "2.0.0-beta.1",
Expand All @@ -182,6 +186,7 @@
"cross-env": "^5.1.0",
"cz-conventional-changelog": "^1.2.0",
"danger": "^1.1.0",
"dependency-cruiser": "^2.6.0",
"doctoc": "^1.0.0",
"escape-string-regexp": "^1.0.5 ",
"esdoc": "^0.4.7",
Expand Down Expand Up @@ -222,8 +227,7 @@
"ts-node": "^3.3.0",
"tslib": "^1.5.0",
"tslint": "^4.4.2",
"typescript": "~2.0.6",
"typings": "^2.0.0",
"typescript": "latest",
"validate-commit-msg": "^2.14.0",
"watch": "^1.0.1",
"webpack": "^1.13.1",
Expand Down
1 change: 0 additions & 1 deletion spec/helpers/marble-testing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
///<reference path='../../typings/index.d.ts'/>
import { Observable } from '../../src/Observable';
import { SubscriptionLog } from '../../src/testing/SubscriptionLog';
import { ColdObservable } from '../../src/testing/ColdObservable';
Expand Down
2 changes: 0 additions & 2 deletions spec/helpers/test-helper.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
///<reference path='../../typings/index.d.ts'/>
declare const global: any;

import * as Rx from '../../src/Rx';
import { ObservableInput } from '../../src/Observable';
import { root } from '../../src/util/root';
import { $$iterator } from '../../src/symbol/iterator';
import $$symbolObservable from 'symbol-observable';
import { Observable } from '../../src/Observable';

export function lowerCaseO<T>(...args: Array<any>): Rx.Observable<T> {

Expand Down
2 changes: 0 additions & 2 deletions spec/helpers/testScheduler-ui.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
///<reference path='../../typings/index.d.ts'/>

import * as _ from 'lodash';
//import * as commonInterface from 'mocha/lib/interfaces/common';
//import * as escapeRe from 'escape-string-regexp';
Expand Down
4 changes: 1 addition & 3 deletions spec/util/UnsubscriptionError-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ describe('UnsubscriptionError', () => {
subscription.unsubscribe();
} catch (err) {
expect(err instanceof UnsubscriptionError).to.equal(true);
expect(err.message).to.equal(`2 errors occurred during unsubscription:
1) ${err1}
2) ${err2}`);
expect(err.errors).to.deep.equal([err1, err2]);
expect(err.name).to.equal('UnsubscriptionError');
}
});
Expand Down
4 changes: 4 additions & 0 deletions src/observable/dom/AjaxObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ export class AjaxError extends Error {
this.status = xhr.status;
this.responseType = xhr.responseType || request.responseType;
this.response = parseXhrResponse(this.responseType, xhr);

this.name = 'AjaxError';
(Object as any).setPrototypeOf(this, AjaxError.prototype);
}
}

Expand Down Expand Up @@ -480,5 +483,6 @@ function parseXhrResponse(responseType: string, xhr: XMLHttpRequest) {
export class AjaxTimeoutError extends AjaxError {
constructor(xhr: XMLHttpRequest, request: AjaxRequest) {
super('ajax timeout', xhr, request);
(Object as any).setPrototypeOf(this, AjaxTimeoutError.prototype);
}
}
7 changes: 3 additions & 4 deletions src/util/ArgumentOutOfRangeError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
*/
export class ArgumentOutOfRangeError extends Error {
constructor() {
const err: any = super('argument out of range');
(<any> this).name = err.name = 'ArgumentOutOfRangeError';
(<any> this).stack = err.stack;
(<any> this).message = err.message;
super('argument out of range');
this.name = 'ArgumentOutOfRangeError';
(Object as any).setPrototypeOf(this, ArgumentOutOfRangeError.prototype);
}
}
7 changes: 3 additions & 4 deletions src/util/EmptyError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
*/
export class EmptyError extends Error {
constructor() {
const err: any = super('no elements in sequence');
(<any> this).name = err.name = 'EmptyError';
(<any> this).stack = err.stack;
(<any> this).message = err.message;
super('no elements in sequence');
this.name = 'EmptyError';
(Object as any).setPrototypeOf(this, EmptyError.prototype);
}
}
7 changes: 3 additions & 4 deletions src/util/ObjectUnsubscribedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
*/
export class ObjectUnsubscribedError extends Error {
constructor() {
const err: any = super('object unsubscribed');
(<any> this).name = err.name = 'ObjectUnsubscribedError';
(<any> this).stack = err.stack;
(<any> this).message = err.message;
super('object unsubscribed');
this.name = 'ObjectUnsubscribedError';
(Object as any).setPrototypeOf(this, ObjectUnsubscribedError.prototype);
}
}
7 changes: 3 additions & 4 deletions src/util/TimeoutError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
*/
export class TimeoutError extends Error {
constructor() {
const err: any = super('Timeout has occurred');
(<any> this).name = err.name = 'TimeoutError';
(<any> this).stack = err.stack;
(<any> this).message = err.message;
super('Timeout has occurred');

(Object as any).setPrototypeOf(this, TimeoutError.prototype);
}
}
8 changes: 3 additions & 5 deletions src/util/UnsubscriptionError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
*/
export class UnsubscriptionError extends Error {
constructor(public errors: any[]) {
super();
const err: any = Error.call(this, errors ?
super(errors ?
`${errors.length} errors occurred during unsubscription:
${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '');
(<any> this).name = err.name = 'UnsubscriptionError';
(<any> this).stack = err.stack;
(<any> this).message = err.message;
this.name = 'UnsubscriptionError';
(Object as any).setPrototypeOf(this, UnsubscriptionError.prototype);
}
}
12 changes: 0 additions & 12 deletions typings.json

This file was deleted.