mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-20 12:46:36 +08:00
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:
6
types/app-root-dir/app-root-dir-tests.ts
Normal file
6
types/app-root-dir/app-root-dir-tests.ts
Normal 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
20
types/app-root-dir/index.d.ts
vendored
Normal 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;
|
||||
23
types/app-root-dir/tsconfig.json
Normal file
23
types/app-root-dir/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
3
types/app-root-dir/tslint.json
Normal file
3
types/app-root-dir/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user