-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Fix Static Land compliance of the TypeRep exposed by Flutures module version #109
Conversation
This ensures that Future.of and Future.reject are present in module builds as well as UMD builds.
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 44 45 +1
Lines 1069 1074 +5
=====================================
+ Hits 1069 1074 +5
Continue to review full report at Codecov.
|
While reviewing my own code, I realized that for the same reason that |
Would you mind having a peek @rpominov? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
never, | ||
isNever | ||
} from './src/core'; | ||
export {default, default as Future} from './src/future'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure that ES specification allows to do export {default} from '...'
. It maybe the case that it works with current tools by incident, and may not work in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading through the spec, one rule is concerning:
For each IdentifierName
n
in ReferencedBindings of ExportClause: It is a Syntax Error if StringValue ofn
is a ReservedWord
In the spec for ReservedWord we see that default
is actually a reserved word. This would mean that export {Future as default} from '...'
also shouldn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Maybe you should do import Future from './src/future'; export default Future;
to be safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means I have to do it like this:
import _Future from './src/future';
export default _Future;
export const Future = _Future;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, ugly. But I would probably do it like this though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made the same mistake in other places of the code. I'll merge this PR as is, and create a separate issue to discuss the matter.
Other than improving the code organization, this ensures that
Future.of
andFuture.reject
are present in module builds as well as UMD builds.As a result, the following will become possible:
I find that many users expect this to work.