iov-core
iov-core copied to clipboard
Self documenting REPL
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:
- https://github.com/confio/weave-js/blob/master/bin/cli.js#L36-L64
- https://github.com/confio/weave-js/blob/master/bin/args.js
We should be able to do something at least as powerful with the typescript info
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
Just discovered this tidbit in ts-node
> .type profile
const profile: UserProfile
> .type profile.getIdentities
(method) UserProfile.getIdentities(n: number): ReadonlyArray<LocalIdentity>