From f242c4178525fc45c3af7ce895a351084f6845bb Mon Sep 17 00:00:00 2001 From: larshp Date: Tue, 24 Dec 2019 14:39:10 +0100 Subject: [PATCH] add basic typescript typings --- .gitignore | 3 ++- lib/picomatch.js | 2 +- lib/scan.js | 2 +- package.json | 9 +++++++-- tsconfig.json | 11 +++++++++++ 5 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index f969a2c..91fdca1 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ vendor temp tmp TODO.md -package-lock.json \ No newline at end of file +package-lock.json +types \ No newline at end of file diff --git a/lib/picomatch.js b/lib/picomatch.js index 5f96344..06e7770 100644 --- a/lib/picomatch.js +++ b/lib/picomatch.js @@ -22,7 +22,7 @@ const constants = require('./constants'); * console.log(isMatch('a.b')); //=> true * ``` * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. + * @param {String|Array} `glob` One or more glob patterns. * @param {Object=} `options` * @return {Function=} Returns a matcher function. * @api public diff --git a/lib/scan.js b/lib/scan.js index 2f749f0..3fafcd9 100644 --- a/lib/scan.js +++ b/lib/scan.js @@ -33,7 +33,7 @@ const isPathSeparator = code => { * console.log(pm.scan('foo/bar/*.js')); * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } * ``` - * @param {String} `str` + * @param {String} `input` * @param {Object} `options` * @return {Object} Returns an object with tokens and regex source string. * @api public diff --git a/package.json b/package.json index 9eb5883..b025f2d 100644 --- a/package.json +++ b/package.json @@ -11,26 +11,31 @@ "license": "MIT", "files": [ "index.js", + "types/index.d.ts", "lib/**.js" ], "main": "index.js", + "typings": "types/index.d.ts", "engines": { "node": ">=8.6" }, "scripts": { "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", + "test": "npm run lint && npm run mocha && npm run types", "test:ci": "npm run lint && npm run test:cover", + "types": "tsc", "test:cover": "nyc npm run mocha" }, "devDependencies": { + "@types/node": "^13.1.0", "eslint": "^5.16.0", "fill-range": "^7.0.1", "gulp-format-md": "^2.0.0", "mocha": "^6.2.2", "nyc": "^14.1.1", - "time-require": "github:jonschlinkert/time-require" + "time-require": "github:jonschlinkert/time-require", + "typescript": "^3.7.4" }, "keywords": [ "glob", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..cf0035b --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "declaration": true, + "noEmit": false, + "allowJs": true, + "checkJs": false, + "outDir": "types", + "emitDeclarationOnly": true + }, + "include": ["index.js"] +} \ No newline at end of file