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

Move Symbol shims into single file. #844

Closed
benlesh opened this issue Nov 30, 2015 · 2 comments
Closed

Move Symbol shims into single file. #844

benlesh opened this issue Nov 30, 2015 · 2 comments
Labels
help wanted Issues we wouldn't mind assistance with.

Comments

@benlesh
Copy link
Member

benlesh commented Nov 30, 2015

Considering we're shimming Symbol and items on it frequently, I think it would be best to move it into a single file.

That would make this:

import {$$iterator} from '../utils/Symbol_iterator';
import {$$observable} from '../utils/Symbol_observable';

const something = {
  [$$iterator]() { }
  [$$observable]() { }
};

... into this...

import {Symbol} from '../utils/Symbol';

const something = {
  [Symbol.iterator]() { }
  [Symbol.observable]() { }
};
@benlesh benlesh added the help wanted Issues we wouldn't mind assistance with. label Nov 30, 2015
@kwonoj
Copy link
Member

kwonoj commented Dec 1, 2015

Typesciprt side support of es6 global symbol (microsoft/TypeScript#980) makes bit hard to use module name Symbol, causes name collision in es6 build like

192   [Symbol.iterator]() {                                                                                                
       ~~~~~~                                                                                                                                                                                                                                         
src/operators/zip-support.ts(192,4): error TS2470: 'Symbol' reference does not refer to the global Symbol constructor object.                                                                                                                         

while other (cjs, etcs) are built. What about having different name for this module, maybe SymbolPolyfill or something else?

p.s :
seems global symbol is supported for es6 only, using those global symbol and targeting es5 will simply raise lookup failure.

161   [Symbol.iterator]() {
       ~~~~~~
src/operators/zip-support.ts(161,4): error TS2304: Cannot find name 'Symbol'.

@benlesh
Copy link
Member Author

benlesh commented Dec 1, 2015

Sigh. TypeScript. LOL. We may have to go back to using Babel to target ES5.

TypeScript also doesn't allow generators in code targeting ES5. Which isn't a big issue so far, but I've hit it playing around.

@kwonoj kwonoj closed this as completed in 2eb7eec Dec 2, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Issues we wouldn't mind assistance with.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants