Add types for mem-fs

This commit is contained in:
Walter Rumsby
2018-03-21 16:26:51 +13:00
parent 762c590456
commit 5a36ea31c3
4 changed files with 59 additions and 0 deletions

23
types/mem-fs/index.d.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
// 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 events = require('events');
import stream = require('stream');
import File = require('vinyl');
declare namespace FileSystem {
interface Store extends events.EventEmitter {
add: (file: File, content: string) => void;
each: (callback: (file: File, index: number) => void) => void;
get: (filepath: string) => File;
stream: () => stream.Transform;
}
export function create(): Store;
}
export = FileSystem;

View File

@@ -0,0 +1,6 @@
import * as fs from 'mem-fs';
const store = fs.create();
const file = store.get('hello');
store.add(file, 'hahahahah');

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"test/index.ts"
]
}

7
types/mem-fs/tslint.json Normal file
View File

@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"export-just-namespace": false,
"strict-export-declare-modifiers": false
}
}