Skip to content

Commit

Permalink
fix(TypeScript): exported ponyfill now works with TypeScript
Browse files Browse the repository at this point in the history
BREAKING CHANGE: CJS users will now have to
  • Loading branch information
benlesh committed Jun 13, 2016
1 parent ea5022b commit c0b894e
Show file tree
Hide file tree
Showing 6 changed files with 7 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"]
}
2 changes: 0 additions & 2 deletions es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ if (typeof global !== 'undefined') {
}

var result = ponyfill(root);
// being explicit
result['default'] = result;
export default result;
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
],
"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",
Expand Down
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
7 changes: 4 additions & 3 deletions ts-test/test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import $$symbolObservable from '../';

console.log('***********************');
console.log('RUNNING TYPESCRIPT TEST');
console.log('***********************');
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 c0b894e

Please sign in to comment.