Created
August 28, 2015 16:55
-
-
Save fearthecowboy/b0cc082d824b8a7a97f9 to your computer and use it in GitHub Desktop.
Internal module confusion...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="../node/node.d.ts" /> | |
// bug: shouldn't I be able to reference stream.Writable? | |
// adding the import line here makes it so that the consumer can't see this class. | |
// import * as stream from "stream" | |
declare class BufferedMessagePackEncoder { | |
private tail; | |
private encoder; | |
private stream; | |
private buffer; | |
private itemcount; | |
private onComplete; | |
// bug: and use 'stream.Writable' instead of 'any' for the stream parameters. | |
constructor(stream: any, onComplete: (count: number) => void); | |
// ie - I'd like to do this: | |
// constructor(stream: stream.Writable, onComplete: (count: number) => void); | |
write(chunk: any): void; | |
flush(): void; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="../typings/node/node.d.ts" /> | |
/// <reference path="../typings/fluentd/BufferedMessagePackEncoder.d.ts" /> | |
class consumer { | |
// if the BufferedMessagePackEncoder.d.ts file has the import statement in it | |
// this file won't be able to reference the class. | |
private bufferedEncoder: BufferedMessagePackEncoder; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Imports/exports turn files into modules. Once it's a module you'll have to load it to use it.
So, if you add the import to BufferedMessagePackEncoder.d.ts, then that file will become a module. After that, you'll need to add an export to line 7, then import that file instead of ing to it. Once imported, you should be able to dot into the module and get to BufferedMesssagePackEncoder. Something like: