microsoft / node-pty

Fork pseudoterminals in Node.JS
Other
1.42k stars 233 forks source link

Cannot import root module #611

Closed TomzBench closed 11 months ago

TomzBench commented 1 year ago

Environment details

os: linux node-pty: 1.0.0 node: 18.16.1 typescript: 5.1.3

Issue description

Does not work

import pty from "node-pty"

pty.spawn(/* ... */); // Error:  spawn does not exist on type "undefined"

Works

import {spawn} from "node-pty";

spawn(/* ... */); // works

Not sure if this is operator error and im doing something dumb, or maybe the .t.ds file does not match what is expected. in either case the docs don't show how to import so perhaps this is then this issue is more a recommendation to add some notes on the usage in the docs

(Since it compiles via typescript, but fails on runtime with undefined error, it might be a typescript declaration file issue)