-
Notifications
You must be signed in to change notification settings - Fork 102
Fix expression-file by using require and path.resolve #168
base: master
Are you sure you want to change the base?
Conversation
e31d2c6
to
bd0c0f1
Compare
bd0c0f1
to
b18621e
Compare
54ed1d4
to
44d46ff
Compare
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.
To fix #58, I would prefer to add a new option instead of changing what --expression-file means. It does basically what it says -- generates types based on evaluating the last expression in a file. Perhaps it should have the name --last-expression-in-file by default.
It's likely that the fix for #65 will be more complicated, since it will have to retain the eval-last-expression behaviour of --expression-file.
I don't see how this fixes #105. There aren't any require
s in that file at all, it's just an IIFE. Can you explain?
I wanted to call this
There is no such requirement. People use |
How can I build and try this branch? |
I can publish this on npm if you like. It is more maintained than dts-gen. |
That'd be great. |
44d46ff
to
8c4c60b
Compare
Here you go. I have published it until this is merged:
|
Anyone? |
Use it until this is merged:
Description
It fixes
expression-file
to support any JavaScript file as the input.Fixes #58
Fixes #65
Fixes #105
Reasoning
It seems that
eval
acts buggy when it comes to resolving dependencies. Butrequire
doesn't have this issue as it is just what Node uses by default. Also,path.resolve
is needed before passing the file path torequire
.Suggestion
If I could, I would have renamed
expression-file
tofile
and renamed the currentfile
argument tooutput-file
. The naming of the arguments is inaccurate and confusing.