Skip to content

Function parameter default values must not refer their own local scope (es spec violation) #18378

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

Closed
falsandtru opened this issue Sep 11, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@falsandtru
Copy link
Contributor

Babel works correctly.

TypeScript Version: master

Code

f();

function f(o = {g}) {
  return console.log(o.g());

  function g() {
    return 1;
  }
}

function g() {
  return 0;
}

Expected behavior:

$ node built/local/tsc.js index.ts && node index.js
0
$ node index.ts
0

Actual behavior:

$ node built/local/tsc.js index.ts && node index.js
1
$ node index.ts
0
@falsandtru falsandtru changed the title Function default values must not refer own local scope (es spec violation) Function parameter default values must not refer their own local scope (es spec violation) Sep 11, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Sep 11, 2017

Duplicate of #2584

@mhegazy mhegazy marked this as a duplicate of #2584 Sep 11, 2017
@mhegazy mhegazy added the Duplicate An existing issue was already created label Sep 11, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 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
Projects
None yet
Development

No branches or pull requests

2 participants