Skip to content

Commit d3742e1

Browse files
LinusUTooTallNate
authored andcommitted
Fix exporting in TypeScript definitions (#128)
1 parent 4a8c1a9 commit d3742e1

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

index.d.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import { Writable, WritableOptions } from 'stream';
22

3-
export interface Options extends WritableOptions {
4-
readonly channels?: number;
5-
readonly bitDepth?: number;
6-
readonly sampleRate?: number;
7-
readonly lowWaterMark?: number;
8-
readonly highWaterMark?: number;
9-
}
3+
namespace Speaker {
4+
interface Options extends WritableOptions {
5+
readonly channels?: number;
6+
readonly bitDepth?: number;
7+
readonly sampleRate?: number;
8+
readonly lowWaterMark?: number;
9+
readonly highWaterMark?: number;
10+
}
1011

11-
export interface Format {
12-
readonly float?: boolean;
13-
readonly signed?: boolean;
14-
readonly bitDepth?: number;
15-
readonly channels?: number;
16-
readonly sampleRate?: number;
17-
readonly samplesPerFrame?: number;
12+
interface Format {
13+
readonly float?: boolean;
14+
readonly signed?: boolean;
15+
readonly bitDepth?: number;
16+
readonly channels?: number;
17+
readonly sampleRate?: number;
18+
readonly samplesPerFrame?: number;
19+
}
1820
}
1921

2022
/**
@@ -23,8 +25,8 @@ export interface Format {
2325
*
2426
* @param opts options.
2527
*/
26-
export default class Speaker extends Writable {
27-
constructor(opts?: Options);
28+
class Speaker extends Writable {
29+
constructor(opts?: Speaker.Options);
2830

2931
/**
3032
* Closes the audio backend. Normally this function will be called automatically
@@ -42,7 +44,7 @@ export default class Speaker extends Writable {
4244
* @param format format object with `channels`, `sampleRate`, `bitDepth`, etc.
4345
* @return MPG123_ENC_* constant, or `null`
4446
*/
45-
public getFormat(format: Format): number | null;
47+
public getFormat(format: Speaker.Format): number | null;
4648

4749
/**
4850
* Returns whether or not "format" is playable via the "output module"
@@ -53,3 +55,5 @@ export default class Speaker extends Writable {
5355
*/
5456
public isSupported(format: number): boolean;
5557
}
58+
59+
exports = Speaker

0 commit comments

Comments
 (0)