Skip to content

Commit d185ff8

Browse files
david-driscollkwonoj
authored andcommitted
chore(typings): removed ambient symbol, and use of Iterable<T>
These are currently not compatible with ES5 targets
1 parent 3d22c7a commit d185ff8

File tree

8 files changed

+16
-41
lines changed

8 files changed

+16
-41
lines changed

Diff for: package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@
7272
"copy_src_cjs": "mkdirp ./dist/cjs/src && cp -r ./src/* ./dist/cjs/src",
7373
"copy_src_es6": "mkdirp ./dist/es6/src && cp -r ./src/* ./dist/es6/src",
7474
"commit": "git-cz",
75-
"compile_dist_amd": "tsc typings/main/ambient/es6-shim/index.d.ts ./spec/es5.d.ts ./dist/amd/src/Rx.ts ./dist/amd/src/Rx.KitchenSink.ts ./dist/amd/src/Rx.DOM.ts ./dist/amd/src/add/observable/of.ts -m amd --sourceMap --outDir ./dist/amd --target ES5 --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
76-
"compile_dist_cjs": "tsc typings/main/ambient/es6-shim/index.d.ts ./spec/es5.d.ts ./dist/cjs/src/Rx.ts ./dist/cjs/src/Rx.KitchenSink.ts ./dist/cjs/src/Rx.DOM.ts ./dist/cjs/src/add/observable/of.ts -m commonjs --sourceMap --outDir ./dist/cjs --target ES5 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
77-
"compile_dist_es6": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/Rx.KitchenSink.ts ./dist/es6/src/Rx.DOM.ts ./dist/es6/src/add/observable/of.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
78-
"compile_dist_es6_for_docs": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/Rx.KitchenSink.ts ./dist/es6/src/Rx.DOM.ts ./dist/es6/src/add/observable/of.ts ./dist/es6/src/MiscJSDoc.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
75+
"compile_dist_amd": "tsc typings/main/ambient/es6-shim/index.d.ts ./dist/amd/src/Rx.ts ./dist/amd/src/Rx.KitchenSink.ts ./dist/amd/src/Rx.DOM.ts ./dist/amd/src/add/observable/of.ts -m amd --sourceMap --outDir ./dist/amd --target ES5 --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
76+
"compile_dist_cjs": "tsc typings/main/ambient/es6-shim/index.d.ts ./dist/cjs/src/Rx.ts ./dist/cjs/src/Rx.KitchenSink.ts ./dist/cjs/src/Rx.DOM.ts ./dist/cjs/src/add/observable/of.ts -m commonjs --sourceMap --outDir ./dist/cjs --target ES5 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
77+
"compile_dist_es6": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/Rx.KitchenSink.ts ./dist/es6/src/Rx.DOM.ts ./dist/es6/src/add/observable/of.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
78+
"compile_dist_es6_for_docs": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/Rx.KitchenSink.ts ./dist/es6/src/Rx.DOM.ts ./dist/es6/src/add/observable/of.ts ./dist/es6/src/MiscJSDoc.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors",
7979
"cover": "npm-run-all cover_test cover_remapping",
80-
"cover_test": "rm -rf dist/cjs && tsc typings/main/ambient/es6-shim/index.d.ts ./spec/es5.d.ts src/Rx.ts src/Rx.KitchenSink.ts src/Rx.DOM.ts src/add/observable/of.ts -m commonjs --outDir dist/cjs --sourceMap --target ES5 -d && istanbul cover -x \"spec-js/**/*\" ./node_modules/mocha/bin/_mocha -- --opts spec/support/default.opts spec-js",
80+
"cover_test": "rm -rf dist/cjs && tsc typings/main/ambient/es6-shim/index.d.ts src/Rx.ts src/Rx.KitchenSink.ts src/Rx.DOM.ts src/add/observable/of.ts -m commonjs --outDir dist/cjs --sourceMap --target ES5 -d && istanbul cover -x \"spec-js/**/*\" ./node_modules/mocha/bin/_mocha -- --opts spec/support/default.opts spec-js",
8181
"cover_remapping": "remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped.json && remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped.lcov -t lcovonly && remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped -t html",
8282
"decision_tree_widget": "cd doc/decision-tree-widget && npm run build && cd ../..",
8383
"generate_packages": "node .make-packages.js",

Diff for: spec/es5.d.ts

-13
This file was deleted.

Diff for: spec/observables/from-spec.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {expect} from 'chai';
22
import * as Rx from '../../dist/cjs/Rx.KitchenSink';
33
import {$$iterator} from '../../dist/cjs/symbol/iterator';
4-
import {Observablesque} from '../../dist/cjs/Observable';
54

65
declare const {expectObservable, Symbol, type};
76
declare const rxTestScheduler: Rx.TestScheduler;
@@ -117,7 +116,7 @@ describe('Observable.from', () => {
117116
});
118117

119118
it('should handle an "observableque" object', (done: MochaDone) => {
120-
const observablesque: Observablesque<any> = <any>{};
119+
const observablesque = <any>{};
121120

122121
observablesque[Symbol.observable] = () => {
123122
return {
@@ -138,7 +137,7 @@ describe('Observable.from', () => {
138137
});
139138

140139
it('should accept scheduler for observableque object', () => {
141-
const observablesque: Observablesque<any> = <any>{};
140+
const observablesque = <any>{};
142141

143142
observablesque[Symbol.observable] = () => {
144143
return {
@@ -167,7 +166,7 @@ describe('Observable.from', () => {
167166
});
168167

169168
it('should handle any iterable thing', (done: MochaDone) => {
170-
const iterable: Iterable<string> = <any>{};
169+
const iterable = <any>{};
171170
const iteratorResults = [
172171
{ value: 'one', done: false },
173172
{ value: 'two', done: false },
@@ -218,9 +217,8 @@ describe('Observable.from', () => {
218217
type(() => {
219218
/* tslint:disable:no-unused-variable */
220219
let o1: Rx.Observable<number> = Observable.from(<number[]>[], Rx.Scheduler.asap);
221-
let o2: Rx.Observable<string> = Observable.from(<Iterable<string>>{});
222-
let o3: Rx.Observable<{ a: string }> = Observable.from(Observable.empty<{ a: string }>());
223-
let o4: Rx.Observable<{ b: number }> = Observable.from(new Promise<{b: number}>(resolve => resolve()));
220+
let o2: Rx.Observable<{ a: string }> = Observable.from(Observable.empty<{ a: string }>());
221+
let o3: Rx.Observable<{ b: number }> = Observable.from(new Promise<{b: number}>(resolve => resolve()));
224222
/* tslint:enable:no-unused-variable */
225223
});
226224
});

Diff for: spec/observables/zip-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('Observable.zip', () => {
7777

7878
describe('with iterables', () => {
7979
it('should zip them with values', () => {
80-
const myIterator: Iterable<number> = <any>{
80+
const myIterator = <any>{
8181
count: 0,
8282
next: function () {
8383
return { value: this.count++, done: false };
@@ -103,7 +103,7 @@ describe('Observable.zip', () => {
103103

104104
it('should only call `next` as needed', () => {
105105
let nextCalled = 0;
106-
const myIterator: Iterable<number> = <any>{
106+
const myIterator = <any>{
107107
count: 0,
108108
next: () => {
109109
nextCalled++;

Diff for: spec/operators/zip-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('Observable.prototype.zip', () => {
7777

7878
describe('with iterables', () => {
7979
it('should zip them with values', () => {
80-
const myIterator: Iterable<number> = <any>{
80+
const myIterator = <any>{
8181
count: 0,
8282
next: function () {
8383
return { value: this.count++, done: false };
@@ -102,7 +102,7 @@ describe('Observable.prototype.zip', () => {
102102

103103
it('should only call `next` as needed', () => {
104104
let nextCalled = 0;
105-
const myIterator: Iterable<number> = <any>{
105+
const myIterator = <any>{
106106
count: 0,
107107
next: function () {
108108
nextCalled++;

Diff for: src/Observable.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <reference path="./symbol/symbol.d.ts" />
21
import {PartialObserver, Observer} from './Observer';
32
import {Operator} from './Operator';
43
import {Subscriber} from './Subscriber';
@@ -14,13 +13,8 @@ export interface Subscribable<T> {
1413
subscribe(observer: Observer<T>): AnonymousSubscription;
1514
}
1615

17-
export interface Observablesque<T> {
18-
[Symbol.observable](): Subscribable<T>;
19-
}
20-
21-
export type SubscribableOrPromise<T> = Observablesque<T> | Subscribable<T> | Promise<T>;
22-
export type ArrayOrIterable<T> = Iterable<T> | ArrayLike<T>;
23-
export type ObservableInput<T> = SubscribableOrPromise<T> | ArrayOrIterable<T>;
16+
export type SubscribableOrPromise<T> = Subscribable<T> | Promise<T>;
17+
export type ObservableInput<T> = SubscribableOrPromise<T> | ArrayLike<T>;
2418

2519
/**
2620
* A representation of any set of values over any amount of time. This the most basic building block

Diff for: src/symbol/observable.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <reference path="./symbol.d.ts" />
21
import {root} from '../util/root';
32

43
const Symbol = root.Symbol;

Diff for: src/symbol/symbol.d.ts

-3
This file was deleted.

0 commit comments

Comments
 (0)