elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

[feature suggestion] elm-make auto insert type annotation #184

Closed beenotung closed 6 years ago

beenotung commented 6 years ago

When using elm-make --warn, it warn and provide a guess of the function annotation. It will be great if the tool can auto insert the type annotation if it can be surely guessed.

I am working it on, will make a pull request soon. If there is an existing tool doing that, please kindly point me to that. Thank you.

process-bot commented 6 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

beenotung commented 6 years ago

I'm using this simple external tool for now: build and tools/insert-type.js in https://github.com/beenotung/five-element/commit/451bb559327df4304ed00aadda99deebc42fb5b3

Will invest on the compiler source code later on.

beenotung commented 6 years ago

i wonder if there is typescript definition for the output json

evancz commented 6 years ago

I think this should live in developer tooling. It makes sense for the compiler to provide the infrastructure to figure things out, but not to actually change the code. I think it is important to separate these concerns clearly.

beenotung commented 6 years ago

Maybe can be a package of the elm-x family? Like elm-format