Merge pull request #8090 from asgoth/feature/vinyl-fs-changes

Improves typings for vinyl/vinyl-fs
This commit is contained in:
Masahiro Wakame
2016-02-15 23:08:39 +09:00
3 changed files with 19 additions and 1 deletions
+11
View File
@@ -909,4 +909,15 @@ describe('symlink stream', function () {
stream.end();
});
});
it('should check if it"s a vinyl file', function () {
var srcPath = path.join(__dirname, './fixtures/test.coffee');
var options = {
path: srcPath,
cwd: __dirname,
contents: new Buffer("1234567890")
};
var file = new File(options);
File.isVinyl(file).should.equal(true);
File.isVinyl(options).should.equal(false);
})
});
+3 -1
View File
@@ -4,6 +4,7 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../glob-stream/glob-stream.d.ts" />
/// <reference path="../vinyl/vinyl.d.ts" />
declare module NodeJS {
@@ -15,8 +16,9 @@ declare module NodeJS {
declare module "vinyl-fs" {
import _events = require("events");
import File = require("vinyl");
import globStream = require("glob-stream");
interface ISrcOptions {
interface ISrcOptions extends globStream.Options {
/** Specifies the working directory the folder is relative to */
cwd?: string;
+5
View File
@@ -135,6 +135,11 @@ declare module "vinyl" {
* Returns a pretty String interpretation of the File. Useful for console.log.
*/
public inspect(): string;
/**
* Checks if a given object is a vinyl file.
*/
public static isVinyl(obj: any): boolean;
}
export = File;