diff --git a/.gitignore b/.gitignore index 491fc35..92b258f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules lib +ts-test/test.js diff --git a/es/index.js b/es/index.js index dacce17..548ba11 100644 --- a/es/index.js +++ b/es/index.js @@ -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; diff --git a/index.d.ts b/index.d.ts index e5dd040..6816a1d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,2 +1,2 @@ declare const observableSymbol: symbol; -export = observableSymbol; \ No newline at end of file +export default observableSymbol; diff --git a/package.json b/package.json index fd6ff64..dbf9350 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -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" } } diff --git a/ts-test/test.ts b/ts-test/test.ts new file mode 100644 index 0000000..69e8c4b --- /dev/null +++ b/ts-test/test.ts @@ -0,0 +1,9 @@ +import $$symbolObservable from '../'; + +console.log('***********************'); +console.log('RUNNING TYPESCRIPT TEST'); +console.log('***********************'); + +if (typeof $$symbolObservable !== 'symbol' && $$symbolObservable !== '@@observable') { + throw new Error('Sorry, $symbolObservable is ' + JSON.stringify($$symbolObservable)); +}