Merge pull request #24434 from wrumsby/mem-fs

Add types for mem-fs
This commit is contained in:
Mine Starks
2018-03-23 12:38:59 -07:00
committed by GitHub
4 changed files with 55 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for mem-fs 1.1
// Project: https://github.com/sboudrias/mem-fs
// Definitions by: My Food Bag <https://github.com/MyFoodBag>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { EventEmitter } from 'events';
import { Transform } from 'stream';
import * as File from 'vinyl';
export function create(...args: any[]): memFs.Store;
export namespace memFs {
interface Store extends EventEmitter {
add: (file: File, content: string) => void;
each: (callback: (file: File, index: number) => void) => void;
get: (filepath: string) => File;
stream: () => Transform;
}
}
+8
View File
@@ -0,0 +1,8 @@
import * as fs from 'mem-fs';
const store = fs.create();
const file = store.get('hello');
store.add(file, 'hahahahah');
store.each(file => console.dir(store.get(file.path)));
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"mem-fs-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}