From eb7be7c32c7d60ea60874c9567853c64caded263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Roveg=C3=A5rd?= Date: Fri, 5 Oct 2018 23:50:25 +0200 Subject: [PATCH] grunt - fix grunt.file.expand errors (#29299) - patterns can be a string or a string array - options can have a 'cwd' property --- types/grunt/grunt-tests.ts | 5 +++++ types/grunt/index.d.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/grunt/grunt-tests.ts b/types/grunt/grunt-tests.ts index d4027da3fb..7dd6dcf47c 100644 --- a/types/grunt/grunt-tests.ts +++ b/types/grunt/grunt-tests.ts @@ -133,4 +133,9 @@ exports.exports = function(grunt: IGrunt) { let myTest = function (grunt: IGrunt) { grunt.file.expand(['*.ts']); grunt.file.expand('*.ts'); + + // 'cwd' in options, and string pattern + grunt.file.expand({ + cwd: '.' + }, '*.ts'); } diff --git a/types/grunt/index.d.ts b/types/grunt/index.d.ts index 5187e5e965..15fd9f0959 100644 --- a/types/grunt/index.d.ts +++ b/types/grunt/index.d.ts @@ -446,7 +446,7 @@ declare namespace grunt { * grunt.file.setBase or the --base command-line option. */ expand(patterns: string | string[]): string[]; - expand(options: IFilesConfig, patterns: string[]): string[]; + expand(options: IFilesConfig, patterns: string | string[]): string[]; /** * Returns an array of src-dest file mapping objects. @@ -595,6 +595,12 @@ declare namespace grunt { // filter?: string // filter?: (src: string) => boolean filter?: any; + + /** + * Patterns will be matched relative to this path, and all returned filepaths will + * also be relative to this path. + */ + cwd?: string; } /**