-
Notifications
You must be signed in to change notification settings - Fork 43
Types #90
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
Types #90
Conversation
src/index.ts
Outdated
function compile(sources, options) { | ||
var optionsWithDefaults = prepareOptions(options, options.spawn || spawn); | ||
function compileSync(sources: string | string[], options: Partial<Options>): ChildProcess { | ||
var optionsWithDefaults = prepareOptions(options, spawn.sync as any); |
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.
The Options
contain the spawn constructor. This is difficult, because the async versions use a different one than the sync versions, which I couldn't figure out how to type.
My suggestion would be to factor out the spawn constructor from the options and pass it separately.
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.
👍 we can definitely do some follow up PRs
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, you're right. It's probably best to do that in a separate PR, since it looks like a heavier refactoring.
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 started such a refactor on https://github.com/Y0hy0h/node-elm-compiler/tree/refactor.
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.
This looks good, a nice step towards making this codebase easier to work with! I've left a couple of comments but otherwise I think we should move ahead with our move into TS.
@y0hy0h can we introduce an npm command to run type checking that we can run as part of the build? |
I am not sure if I understand what you mean. I consciously left out If that's not what you want, could you explain what you mean? A dry-run compile command? |
Closed in favor of #107. |
Ports the library to TypeScript.