diff --git a/types/get-func-name/get-func-name-tests.ts b/types/get-func-name/get-func-name-tests.ts new file mode 100644 index 0000000000..3199af25d7 --- /dev/null +++ b/types/get-func-name/get-func-name-tests.ts @@ -0,0 +1,12 @@ +import getFuncName = require('get-func-name'); + +const unknownFunction = function myCoolFunction(word: string) { + return word + 'is cool'; +}; + +const anonymousFunction = (() => { + return () => {}; +})(); + +getFuncName(unknownFunction); // $ExpectType string +getFuncName(anonymousFunction); // $ExpectType string diff --git a/types/get-func-name/index.d.ts b/types/get-func-name/index.d.ts new file mode 100644 index 0000000000..f43bf3dd2a --- /dev/null +++ b/types/get-func-name/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for get-func-name 2.0 +// Project: https://github.com/chaijs/get-func-name#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = getFuncName; + +declare function getFuncName(fn: Function): string; // tslint:disable-line:ban-types diff --git a/types/get-func-name/tsconfig.json b/types/get-func-name/tsconfig.json new file mode 100644 index 0000000000..acb6f50f0e --- /dev/null +++ b/types/get-func-name/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", + "get-func-name-tests.ts" + ] +} diff --git a/types/get-func-name/tslint.json b/types/get-func-name/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/get-func-name/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }