HerringtonDarkholme / typescript-repl

An upgraded TypeScript REPL
210 stars 16 forks source link

REPL is not working in iTerm.app (Mac OS X El Capitan) #17

Closed mkaschenko closed 7 years ago

mkaschenko commented 7 years ago

While it works as expected in Terminal.app it throws the error in iTerm.app:

TSUN : TypeScript Upgraded Node
type in TypeScript expression to evaluate
type :help for commands in repl

> 1
readline.js:982
            throw err;
            ^

TypeError: Cannot read property 'text' of undefined
    at Object.getCurrentCode (/usr/local/lib/node_modules/tsun/bin/src/service.js:197:37)
    at startEvaluate (/usr/local/lib/node_modules/tsun/bin/src/repl.js:140:29)
    at replLoop (/usr/local/lib/node_modules/tsun/bin/src/repl.js:169:9)
    at /usr/local/lib/node_modules/tsun/bin/src/repl.js:283:9
    at Interface._onLine (readline.js:237:5)
    at Interface._line (readline.js:585:8)
    at Interface._ttyWrite (readline.js:862:14)
    at ReadStream.onkeypress (readline.js:126:10)
    at emitTwo (events.js:106:13)
    at ReadStream.emit (events.js:191:7)
HerringtonDarkholme commented 7 years ago

Thanks for reporting this issue. Would you please provide more information about your environment? I cannot reproduce it.

mkaschenko commented 7 years ago

OS X El Capitan version 10.11.6, iTerm2 build 3.0.12, Node version 6.9.1, Typescript version 2.0.10.

ts-node (ts-node v1.7.0) works well in iTerm2.app.

HerringtonDarkholme commented 7 years ago

I guess you are running tsun in a ts-project. That's not a problem of iterm/terminal.app.

Can you give a try in a clean directory?

Also, typescript is a global peer dependency.

mkaschenko commented 7 years ago

You are right. It works outside my ts-project. Do you know what could a reason of this problem?

HerringtonDarkholme commented 7 years ago

Because tsun is aware of your current project. You can import all dependencies in your project.

It seems this feature is not robust enough. Would you mind provide information about your project?

mkaschenko commented 7 years ago

https://gist.github.com/mkaschenko/9d140d46cb9c73737a7f0ab0fca5dc56

HerringtonDarkholme commented 7 years ago

Thanks! The error is so obvious that I forget to reset noEmit flag.

I will patch it later.

HerringtonDarkholme commented 7 years ago

Fixed in 0.3.4!

mkaschenko commented 7 years ago

Thanks a lot.

On Nov 28, 2016, at 18:49, (´・ω・`) notifications@github.com wrote:

Closed #17 https://github.com/HerringtonDarkholme/typescript-repl/issues/17.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HerringtonDarkholme/typescript-repl/issues/17#event-873508782, or mute the thread https://github.com/notifications/unsubscribe-auth/AAH83Q7R1k_d8Z5aH9WxMt_cQLXs-ybOks5rCr-4gaJpZM4K9bLQ.