iov-one / iov-core

Client library for secure key management and multi-blockchain communication
https://iov-one.github.io/iov-core-docs/
Apache License 2.0
198 stars 18 forks source link

Self documenting REPL #220

Open ethanfrey opened 6 years ago

ethanfrey commented 6 years ago

Building on #219

It would be nice for a developer to get some feedback and API insight directly in the REPL. We have this is the IDE, and it doesn't have to be so nice, but at least listing the methods on a class and arguments to a method....

I hacked something like this into the javascript weave-js repl:

We should be able to do something at least as powerful with the typescript info

ethanfrey commented 6 years ago

Apparently this is a known and open issue in ts-node: https://github.com/TypeStrong/ts-node/issues/8

There is a fork that produces something very nice (eg :type Buffer scroll to the bottom of the readme), but this seems unmaintained: https://github.com/HerringtonDarkholme/typescript-repl/blob/master/README.md

Other ideas? I would really like something closer to the IDE type hints when writing functions in the repl

ethanfrey commented 6 years ago

Just discovered this tidbit in ts-node

> .type profile
const profile: UserProfile
> .type profile.getIdentities
(method) UserProfile.getIdentities(n: number): ReadonlyArray<LocalIdentity>