jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.26k stars 508 forks source link

Simplify getInputs function #745

Closed xiaoxiaojx closed 4 years ago

jaredpalmer commented 4 years ago

LGTM

agilgur5 commented 4 years ago

@jaredpalmer would appreciate a heads-up before you come back and merge code very quickly. I have been handling this myself for some time and have been following a process...

I would also not have merged this because this actually further complicates it into a single return statement and further wraps the code, along with adding a cast in there.

I have had to unwrap similar code in the codebase before, such as in createBuildConfigs. The more you wrap something the more brittle and harder to refactor it becomes, a simplification would have been to unwrap it further, with the ternaries being a particularly good place to start