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

Can't use ES6 string methods when not targeting ES6 #4887

Closed
slikts opened this issue Sep 20, 2015 · 2 comments
Closed

Can't use ES6 string methods when not targeting ES6 #4887

slikts opened this issue Sep 20, 2015 · 2 comments
Labels
Duplicate An existing issue was already created Question An issue which isn't directly actionable in code

Comments

@slikts
Copy link

slikts commented Sep 20, 2015

Other ES6 features work when not targeting ES6, but methods like String.prototype.startsWith produce compilation errors. My expectation was that ES6 features would work regardless of the target version, and it's not clear what the distinction between the string methods and other features is.

@kitsonk
Copy link
Contributor

kitsonk commented Sep 20, 2015

Functional features are not polyfilled, it is (mainly) only language semantics that are supported when emitting to other targets. For example, Promises don't exist, though they are part of ES2015. You would need to polyfill them yourself or use a library like core.js to polyfill them for you.

@DanielRosenwasser
Copy link
Member

For the record, there's a core-js definition file on DefinitelyTyped. I think #4168 is the appropriate issue for discussion otherwise.

@DanielRosenwasser DanielRosenwasser added Duplicate An existing issue was already created Question An issue which isn't directly actionable in code labels Sep 20, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

3 participants