-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Re-exporting the Record module creates a runtime exception #1249
Comments
@OliverJAsh ran some tests and it may potentially be because of the following code generated by TS var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
} In this case, it feels like the Lines 162 to 164 in 1b0ee81
Looks like renaming it should fix the issue Ref on the TS repo: microsoft/TypeScript#3197 |
@OliverJAsh RE: the "bug" label. It doesn't look |
Yeah you're right. Although the TS team have already said they won't fix this, so I guess it's on us to workaround it instead? microsoft/TypeScript#3197 (comment) |
I see. I can't rename However, as a fix, I can try to handle const _hasOwnProperty = Object.prototype.hasOwnProperty
export function hasOwnProperty<K extends string>(k: string, r: ReadonlyRecord<K, unknown>): k is K
export function hasOwnProperty<K extends string>(this: any, k: string, r?: ReadonlyRecord<K, unknown>): k is K {
return _hasOwnProperty.call(r === undefined ? this : r, k)
} what do you think? |
That should work! |
This bug is happening again in 2.10.0 when we try to call We need to apply the same fix to Line 28 in 6a38637
I'll raise a PR. |
@OliverJAsh damn, I forgot again this issue, I'm sorry :( This is an internal function so we can rename it (to |
Unfortunately the issue persists in 2.10.1. I think this change is also causing an issue: 281dc29#diff-dc4b4fb0cd6e06c8bf587eb2f8817ffa1ed096efe2c6c5175d3604fb57d3a96cR796
I'm not sure how we should fix this. WDYT @gcanti? |
🐛 Bug report
Current Behavior
We usually "extend" some modules with our own operators and we do this by re-exporting the module from another file such as:
So in the codebase, we can do:
We've been doing that for different modules such as
Option
,Array
,Either
etc and all is good but for some reason re-exportingRecord
creates the following runtime exceptionExpected behavior
No runtime exception. Allowing us to re-export the module to extend it.
Your environment
The text was updated successfully, but these errors were encountered: