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

Export as value not properly transpiled when accessed inline #847

Closed
megakoresh opened this issue Jun 25, 2019 · 1 comment
Closed

Export as value not properly transpiled when accessed inline #847

megakoresh opened this issue Jun 25, 2019 · 1 comment

Comments

@megakoresh
Copy link

megakoresh commented Jun 25, 2019

Almost posted this issue to typescript main repo, good thing I checked first - this only happens under ts-node. Here is the issue text:

Code

// some-const.ts
export default {
  "a": {
    "b": 3
  },
  "c": [
    {
      "d": "e"
    }
  ]
}

// main.ts
import someConst from './some-const.ts';
import * as R from 'ramda';

const result = R.mergeDeepRight(someConst, { c: [{ d: "f" }] })

console.log(result.c[0].d); // outputs "e"

Expected behavior:

Value has same structure as in declaration.

Actual behavior:
Original value someConst is not present. Instead some_const_1 is present with the following structure:

{
  __esModule: true,
  default: { ...someConst } //actual value
}

After merging with some other object like above the result is

{
  __esModule: true,
  default: { ...someConst },
  c: [
    {
      d: "f"
    }
  ]
}

which is of course not what I want. The object some_const_1 should be accessed in generated code using it's default value, since it's a constant - some_const_1.default.

If this code is compiled using normal typescript, the output is like this:

//...
const result = R.mergeDeepRight(some_const_1.default, { c: [{ d: "f" }] });
//...

Which is what I expect. However under ts-node that doesn't seem to be the case.

@megakoresh
Copy link
Author

Never mind this is a ramda issue. Caused a lot of headache.

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

1 participant