diff --git a/types/app-root-dir/app-root-dir-tests.ts b/types/app-root-dir/app-root-dir-tests.ts new file mode 100644 index 0000000000..eecfc42d03 --- /dev/null +++ b/types/app-root-dir/app-root-dir-tests.ts @@ -0,0 +1,7 @@ +import * as rootDir from 'app-root-dir' + +let appRootPath: string + +rootDir.set(__dirname) +appRootPath = rootDir.get() + diff --git a/types/app-root-dir/index.d.ts b/types/app-root-dir/index.d.ts new file mode 100644 index 0000000000..9c7fb51cbc --- /dev/null +++ b/types/app-root-dir/index.d.ts @@ -0,0 +1,21 @@ +import { interfaceExtends } from '../babel-types/index.d' +// Type definitions for [ app-root-dir ] [ 1.0.2 ] +// Project : [ https://github.com/philidem/node-app-root-dir ] +// Definitions by: shaochenyang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface AppRootDir { + // Get the application's root directory + get(): string + /** + * Set the application's root directory + * this will set a global so that no matter + * how many instances of app-root-dir module are installed, + * they will all return the same directory + */ + set(dirname: string): void +} + +declare const AppRootDir: AppRootDir + +export = AppRootDir diff --git a/types/app-root-dir/tsconfig.json b/types/app-root-dir/tsconfig.json new file mode 100644 index 0000000000..c3a03ef0b7 --- /dev/null +++ b/types/app-root-dir/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": ["node"], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "app-root-dir-tests.ts" + ] +} diff --git a/types/app-root-dir/tslint.json b/types/app-root-dir/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/app-root-dir/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}