denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.76k stars 5.34k forks source link

Feature request: repl: add type inspection command #17072

Open win-t opened 1 year ago

win-t commented 1 year ago

Hello, I have an idea. I think we need a command to inspect the type of a symbol, something like :type command in ghci it is a command that only available in repl for example

> :type console.log
console.log : (...data: any[]) => void
> import * as react from `npm:react'
undefined
> :type react.useEffect
react.useEffect : (effect: EffectCallback, deps?: DependencyList) => void

of course, this feature is only available to any symbol that has a typescript declaration

win-t commented 1 year ago

maybe related to https://github.com/denoland/deno/issues/16938 and https://github.com/denoland/deno/pull/16800 I think it is better to have a command that is only available on repl instead of exposing the functionality as a dedicated function psql is also another repl that I know to have this command separation

dsherret commented 1 year ago

Related: https://github.com/denoland/deno/issues/11078#issuecomment-879826371