Skip to content
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

Can't redefine a function #729

Closed
vemv opened this issue Nov 12, 2018 · 1 comment · Fixed by #1396
Closed

Can't redefine a function #729

vemv opened this issue Nov 12, 2018 · 1 comment · Fixed by #1396
Labels
you can do this Good candidate for a pull request.
Milestone

Comments

@vemv
Copy link

vemv commented Nov 12, 2018

(Similar but possibly different / easier than #472)

A popular workflow in the Lisp/Clojure community is "REPL-driven development", by which you develop things at the REPL first, repeatedly (re)defining functions at a granular level, until each function is deemed correct.

Errors like [eval].ts(17,10): error TS2393: Duplicate function implementation. impair this workflow, and make ts-node less useful for such a crowd.

Is there any way to disable this behavior?

Thanks - Victor

@blakeembrey
Copy link
Member

Unfortunately this may be tricky to do. We need to use a single file for TypeScript so it knows the names are all in scope, and TypeScript doesn’t like overriding a name like this. One easy trick is just ignore that error code - either by default in the REPL or just your own REPL. The same could be done for variables, and rewrite variables to always be mutable. Not entirely sure but let me know if ignoring the error for now is good enough, then we could intro the behaviour behind a flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
you can do this Good candidate for a pull request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants