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

Addendum to #11... adding TS test #12

Closed
wants to merge 3 commits into from
Closed
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
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
7 changes: 5 additions & 2 deletions es/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* 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);
// being explicit
result['default'] = result;
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;
5 changes: 3 additions & 2 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 @@ -38,6 +38,7 @@
"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"
}
}
9 changes: 9 additions & 0 deletions ts-test/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import $$symbolObservable from '../';

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

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