mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #23543 from jason0x43/webpack-loader
Fix Loader type in webpack
This commit is contained in:
Vendored
+4
-2
@@ -9,6 +9,7 @@
|
||||
// Ahmed T. Ali <https://github.com/ahmed-taj>
|
||||
// Alan Agius <https://github.com/alan-agius4>
|
||||
// Spencer Elliott <https://github.com/elliottsj>
|
||||
// Jason Cheatham <https://github.com/jason0x43>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -16,6 +17,7 @@
|
||||
|
||||
import Tapable = require('tapable');
|
||||
import * as UglifyJS from 'uglify-js';
|
||||
import { RawSourceMap } from 'source-map';
|
||||
|
||||
export = webpack;
|
||||
|
||||
@@ -1021,7 +1023,7 @@ declare namespace webpack {
|
||||
|
||||
namespace loader {
|
||||
interface Loader extends Function {
|
||||
(this: LoaderContext, source: string | Buffer, sourceMap: string | Buffer): string | Buffer | void | undefined;
|
||||
(this: LoaderContext, source: string | Buffer, sourceMap?: RawSourceMap): string | Buffer | void | undefined;
|
||||
|
||||
/**
|
||||
* The order of chained loaders are always called from right to left.
|
||||
@@ -1041,7 +1043,7 @@ declare namespace webpack {
|
||||
raw?: boolean;
|
||||
}
|
||||
|
||||
type loaderCallback = (err: Error | undefined | null, content?: string | Buffer, sourceMap?: string | Buffer) => void;
|
||||
type loaderCallback = (err: Error | undefined | null, content?: string | Buffer, sourceMap?: RawSourceMap) => void;
|
||||
|
||||
interface LoaderContext {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.7.0"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import webpack = require('webpack');
|
||||
import { RawSourceMap } from 'source-map';
|
||||
|
||||
const {
|
||||
optimize,
|
||||
@@ -642,7 +643,7 @@ configuration = {
|
||||
performance,
|
||||
};
|
||||
|
||||
function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sourcemap: string | Buffer): void {
|
||||
function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sourcemap?: RawSourceMap): void {
|
||||
this.cacheable();
|
||||
|
||||
this.async();
|
||||
|
||||
Reference in New Issue
Block a user