Skip to content

Commit

Permalink
chore(merge): merge commit to fix TypeScript
Browse files Browse the repository at this point in the history
Fix typescript (continuation of PR 11 and 12)
  • Loading branch information
benlesh authored Jun 13, 2016
2 parents 6ebe9ca + c0b894e commit a6d2ef5
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"presets": ["es2015"],
"plugins": ["add-module-exports"],
"presets": ["es2015"]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
lib
ts-test/test.js
5 changes: 3 additions & 2 deletions es/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* global window */
import ponyfill from './ponyfill';

let root = this;
var root = this;
if (typeof global !== 'undefined') {
root = global;
} else if (typeof window !== 'undefined') {
root = window;
}

export default ponyfill(root);
var result = ponyfill(root);
export default result;
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
declare const observableSymbol: symbol;
export = observableSymbol;
export default observableSymbol;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"node": ">=0.10.0"
},
"scripts": {
"test": "npm run build && mocha && tsc ./ts-test/test.ts && node ./ts-test/test.js",
"build": "babel es --out-dir lib",
"test": "npm run build && mocha",
"prepublish": "npm test"
},
"files": [
Expand All @@ -37,9 +37,9 @@
],
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.9.0",
"chai": "^3.5.0",
"mocha": "^2.4.5"
"mocha": "^2.4.5",
"typescript": "^1.8.10"
}
}
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global describe, it */
var expect = require('chai').expect;
var $$observable = require('../');
var $$observable = require('../').default;

describe('integration test', function () {
if (typeof Symbol === 'function') {
Expand Down
2 changes: 1 addition & 1 deletion test/ponyfill.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global describe, it */
var expect = require('chai').expect;
var ponyfill = require('../lib/ponyfill');
var ponyfill = require('../lib/ponyfill').default;

describe('ponyfill unit tests', function () {
describe('when Symbol does NOT exist as a function', function () {
Expand Down
10 changes: 10 additions & 0 deletions ts-test/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import $$symbolObservable from '../';

console.log('RUNNING TYPESCRIPT TEST...');

if (typeof $$symbolObservable !== 'symbol' && <any>$$symbolObservable !== '@@observable') {
console.log('FAIL');
throw new Error('Sorry, $symbolObservable is ' + JSON.stringify($$symbolObservable));
}

console.log('PASS');

0 comments on commit a6d2ef5

Please sign in to comment.