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

EsNext doesn't convert var into let or const #138

Closed
ferrybig opened this issue Feb 28, 2018 · 2 comments
Closed

EsNext doesn't convert var into let or const #138

ferrybig opened this issue Feb 28, 2018 · 2 comments

Comments

@ferrybig
Copy link

ferrybig commented Feb 28, 2018

Since let and const are new since ES6, EsNext should convert them. But it doesn't at the moment:

var memoize = require('lodash').memoize;

var upperCase = memoize(function(string) {
  return string.toUpperCase();
});

Becomes

import { memoize } from 'lodash';

var upperCase = memoize(function(string) {
  return string.toUpperCase();
});

While it should have been:

import { memoize } from 'lodash';

const upperCase = memoize(function(string) {
  return string.toUpperCase();
});

Version: Using the EsNext playground

@eventualbuddha
Copy link
Contributor

Hmm. I think it might just be that the playground is out of date. Have you verified this on your own machine? I get this after installing esnext globally:

 esnext <<EOS
heredoc> var memoize = require('lodash').memoize;

var upperCase = memoize(function(string) {
  return string.toUpperCase();
});
heredoc> EOS
import { memoize } from 'lodash';

const upperCase = memoize(string => string.toUpperCase());

@eventualbuddha
Copy link
Contributor

Closing as this is no longer relevant to the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants