-
-
Notifications
You must be signed in to change notification settings - Fork 538
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: pass transformers object to ts.transpileModule method (Fixes #1051) #1054
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1054 +/- ##
=======================================
Coverage 74.83% 74.83%
=======================================
Files 6 6
Lines 608 608
Branches 142 142
=======================================
Hits 455 455
Misses 100 100
Partials 53 53
Continue to review full report at Codecov.
|
@thetutlage Thanks for the speedy PR! What is the reason for moving the assertion into |
The main reason for moving the Inside Now, in order to narrow it down, we have two options
What you think? |
Using a type assertion makes more sense. We need to keep the assertion
where it was because that's the more intuitive place for a `TypeError` to
be thrown. It makes the API better.
…On Sun, May 24, 2020, 2:06 AM Harminder Virk ***@***.***> wrote:
The main reason for moving the typeof transformers === 'function' check
inside the getOutputTranspileOnly method is to narrow down the
transformers type.
Inside getOutputTranspileOnly the transformers variable is typed as
follows
[image: Screen Shot 2020-05-24 at 11 33 36 AM]
<https://user-images.githubusercontent.com/1706381/82746917-7cb1fb80-9db2-11ea-8c72-1ab78ad0105e.png>
Now, in order to narrow it down, we have two options
- Move the if condition inside this method (like I did)
- Manually type cast transformers to Exclude the factory function
What you think?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1054 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OBIUXYWDVYN6C4DIC3RTC2ORANCNFSM4NIPHT2Q>
.
|
If I get it right, you are saying to move the Right? |
Correct.
…On Sun, May 24, 2020, 5:05 AM Harminder Virk ***@***.***> wrote:
If I get it right, you are saying to move the typeof check to its
original place (where it was earlier) and instead go with 2nd option, ie: Manually
type cast transformers to Exclude the factory function
Right?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1054 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OHXOUIKLUFQ5VVVA4TRTDPN3ANCNFSM4NIPHT2Q>
.
|
Does it look fine now? |
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.
Sweet, looks great!
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.
@cspotcode Is there any reason we shouldn't move the getOutputTranspileOnly
function back within the else
block?
No reason. Yeah, we should move it back. I'll do that here and merge.
…On Mon, May 25, 2020, 1:02 PM Blake Embrey ***@***.***> wrote:
***@***.**** approved this pull request.
@cspotcode <https://github.com/cspotcode> Is there any reason we
shouldn't move the getOutputTranspileOnly function back within the else
block?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1054 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OFF2NKXPZM37GR4T4LRTKQDRANCNFSM4NIPHT2Q>
.
|
Nevermind, I'm going to do it as a separate PR, cuz it'll be clearer that way. |
@cspotcode Any idea when this will be released? |
No set date; maybe this weekend? Depends when someone has time; work is
keeping me busy this month.
In the meantime, you can install off of master (npm can install straight
from git) or downgrade to an older version.
…On Tue, Jun 2, 2020 at 10:49 AM Harminder Virk ***@***.***> wrote:
@cspotcode <https://github.com/cspotcode> Any idea when this will be
released?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1054 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OAPTEUGJQJKV4XSTVDRUUGOPANCNFSM4NIPHT2Q>
.
|
As per the README, only the
transformers factory function
is not allowed during thetranspileOnly
module. However, an object can still be passed.In this PR https://github.com/TypeStrong/ts-node/pull/879/files#diff-f41e9d04a45c83f3b6f6e630f10117feR383, the code already guards against the factory function, but doesn't pass the transformers to the
transpileModule
method.Related issue #1051