mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Utilize generics in plugin loading
This commit is contained in:
parent
8f8e8c55bf
commit
bbf926bcf0
@ -11,7 +11,7 @@ interface GulpPlugins extends IGulpPlugins {
|
||||
concat: typeof gulpConcat;
|
||||
}
|
||||
|
||||
var plugins = <GulpPlugins>gulpLoadPlugins({
|
||||
var plugins = gulpLoadPlugins<GulpPlugins>({
|
||||
pattern: ['gulp-*', 'gulp.*'],
|
||||
config: 'package.json',
|
||||
scope: ['dependencies', 'devDependencies', 'peerDependencies'],
|
||||
@ -20,7 +20,7 @@ var plugins = <GulpPlugins>gulpLoadPlugins({
|
||||
lazy: true,
|
||||
rename: {}
|
||||
});
|
||||
plugins = <GulpPlugins>gulpLoadPlugins();
|
||||
plugins = gulpLoadPlugins<GulpPlugins>();
|
||||
|
||||
gulp.task('taskName', () => {
|
||||
gulp.src('*.*')
|
||||
@ -33,7 +33,7 @@ gulp.task('taskName', () => {
|
||||
* imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just
|
||||
* sass :
|
||||
*/
|
||||
plugins = <GulpPlugins>gulpLoadPlugins({
|
||||
plugins = gulpLoadPlugins<GulpPlugins>({
|
||||
rename: {
|
||||
'gulp-ruby-sass': 'sass'
|
||||
}
|
||||
|
||||
2
gulp-load-plugins/gulp-load-plugins.d.ts
vendored
2
gulp-load-plugins/gulp-load-plugins.d.ts
vendored
@ -30,7 +30,7 @@ declare module 'gulp-load-plugins' {
|
||||
}
|
||||
|
||||
/** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */
|
||||
function gulpLoadPlugins(options?: IOptions): IGulpPlugins;
|
||||
function gulpLoadPlugins<T extends IGulpPlugins>(options?: IOptions): T;
|
||||
|
||||
export = gulpLoadPlugins;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user