Merge pull request #23733 from chenyang-biu/types-add-app-root-dir

Added new type definition for app-root-dir
This commit is contained in:
Daniel Rosenwasser
2018-02-18 22:19:11 -08:00
committed by GitHub
4 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import * as rootDir from 'app-root-dir';
let appRootPath: string;
rootDir.set('__dirname');
appRootPath = rootDir.get();

20
types/app-root-dir/index.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
// Type definitions for app-root-dir 0.1
// Project: https://github.com/philidem/node-app-root-dir
// Definitions by: shaochenyang <https://github.com/chenyang-biu>
// 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;

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",
"app-root-dir-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}