Skip to content

Commit 235897c

Browse files
committed
Fix dnode types declaration
01309f4 attempted to stronly type dnode, but failed, which caused the ssh terminal feature to stop working. Fixes #73
1 parent 24bf60e commit 235897c

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

src/device.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { dnode } from 'dnode';
1+
import * as dnode from 'dnode';
22
import * as net from 'net';
33
import * as path from 'path';
44
import * as os from 'os';

src/native-helper/shell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// - stdin, stdout and stderr from the remote shell() are connected to the same
1313
// in the shell.ts node process.
1414

15-
import { dnode } from 'dnode';
15+
import * as dnode from 'dnode';
1616
import * as ssh2 from 'ssh2';
1717

1818
export interface Shell {

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": { "*": ["types/*"] },
35
"module": "commonjs",
46
"target": "es6",
57
"outDir": "out",
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
// Project: https://github.com/substack/dnode
33
// Definitions by: David Lechner <[email protected]>
44

5-
declare module 'dnode' {
6-
import * as net from 'net';
5+
/// <reference types="node" />
76

8-
export type ConsFunc<T> = () => T;
7+
declare function dnode<T>(cons: dnode.ConsFunc<T> | T, opt?: {}): dnode.DNode;
8+
export = dnode;
9+
declare namespace dnode {
910

10-
export function dnode<T>(cons: ConsFunc<T> | T, opt?: {}): DNode;
11+
type ConsFunc<T> = () => T;
1112

12-
export interface DNode extends NodeJS.WritableStream {
13+
interface DNode extends NodeJS.WritableStream {
1314
connect(port: number): D;
14-
pipe(socket: net.Socket): void;
15+
pipe(socket: NodeJS.Socket): void;
1516
destroy(): void;
1617
}
1718

18-
export class D {
19+
class D {
1920
on<T>(event: 'remote', listener: (remote: T) => void): void;
2021
end(): void;
2122
}

0 commit comments

Comments
 (0)