question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

__createBinding assumes exports are readonly

See original GitHub issue

Using tslib 1.12.0, we are seeing the following error being thrown:

TypeError: Cannot set property foo of #<Object> which has only a getter

This is a result of this commit, which changes __exportStar to use __createBinding, which now uses Object.defineProperty to create a readonly property on exports.

The implication is that it’s no longer possible to do this in TypeScript:

# module1
export function foo() { /* do something */ }

# module2
export * from 'module1';
export function foo() { /* do another thing */ }

This differs from CommonJS behavior, where it is possible to overwrite previous exports.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
argshookcommented, May 13, 2020

Agree with @sramam this should be treated as a major version.

This issue, together with https://github.com/microsoft/tslib/issues/105 is painful to track down.

I also saw cases where users don’t even use typescript, but because of layers of dependencies, the issue rises up.

3reactions
DanielRosenwassercommented, May 13, 2020

1.13.0 should be available for those impacted by the change. Users on TypeScript 3.9 should look into using tslib 2.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: "exports" is read-only => When exporting a ...
1) Is it possible to have module B import from module C and then export to module A, where the content of module...
Read more >
TSConfig Option: esModuleInterop
This mis-match causes these two issues: the ES6 modules spec states that a namespace import ( import * as x ) can only...
Read more >
MagicDraw UserManual.pdf - No Magic, Inc
Once exported, the package and its containing elements are read-only and the module name ... Use the Binding pattern when you want to...
Read more >
https://unpkg.com/byots@4.3.0-dev.20210224.17.12/b...
Assumes both arrays are sorted * based on the provided comparer. ... export function stopTracing(typeCatalog?: readonly Type[]): void; export enum Phase ...
Read more >
FactoryTalk Batch Recipe Editor User Guide
No patent liability is assumed by Rockwell Automation, Inc. with respect to use of information, ... Import and export restrictions for secured recipes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found