Added new type definition for aoo-root-dir

This commit is contained in:
chenyang 2018-02-17 19:52:34 +08:00
parent 2e4aad4d1f
commit 08d820c93b
4 changed files with 54 additions and 0 deletions

View File

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

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

@ -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 <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": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": ["node"],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"app-root-dir-tests.ts"
]
}

View File

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