diff --git a/types/mem-fs/index.d.ts b/types/mem-fs/index.d.ts new file mode 100644 index 0000000000..dedc40f7fc --- /dev/null +++ b/types/mem-fs/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for mem-fs 1.1 +// Project: https://github.com/SBoudrias/mem-fs +// Definitions by: My Food Bag +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +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; diff --git a/types/mem-fs/test/index.ts b/types/mem-fs/test/index.ts new file mode 100644 index 0000000000..bb925837aa --- /dev/null +++ b/types/mem-fs/test/index.ts @@ -0,0 +1,6 @@ +import * as fs from 'mem-fs'; + +const store = fs.create(); +const file = store.get('hello'); + +store.add(file, 'hahahahah'); diff --git a/types/mem-fs/tsconfig.json b/types/mem-fs/tsconfig.json new file mode 100644 index 0000000000..f0d4f87dbb --- /dev/null +++ b/types/mem-fs/tsconfig.json @@ -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" + ] +} diff --git a/types/mem-fs/tslint.json b/types/mem-fs/tslint.json new file mode 100644 index 0000000000..0189538855 --- /dev/null +++ b/types/mem-fs/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "export-just-namespace": false, + "strict-export-declare-modifiers": false + } +}