DefinitelyTyped/types/file-loader/file-loader-tests.ts
2019-09-24 14:52:36 -07:00

28 lines
1.2 KiB
TypeScript

import * as FileLoader from 'file-loader';
let fn: FileLoader.BuildResourcePathFn;
fn = () => {}; // $ExpectError
fn = () => 1; // $ExpectError
fn = () => ''; // $ExpectType () => string
fn = url => ''; // $ExpectType (url: string) => string
fn = (url, resourcePath, context, forth) => ''; // $ExpectError
let options: FileLoader.Options;
options = {}; // $ExpectType {}
options = { name: '' }; // $ExpectType { name: string; }
options = { name: () => '' }; // $ExpectType { name: () => string; }
options = { outputPath: '' }; // $ExpectType { outputPath: string; }
options = { outputPath: () => '' }; // $ExpectType { outputPath: () => string; }
options = { publicPath: '' }; // $ExpectType { publicPath: string; }
options = { publicPath: () => '' }; // $ExpectType { publicPath: () => string; }
options = { context: '' }; // $ExpectType { context: string; }
options = { context: () => '' }; // $ExpectError
options = { emitFile: true }; // $ExpectType { emitFile: true; }
options = { emitFile: false }; // $ExpectType { emitFile: false; }
options = { emitFile: () => true }; // $ExpectError
options = { regExp: /regex/ }; // $ExpectType { regExp: RegExp; }
options = { regExp: 'regex' }; // $ExpectError
options = { postTransformPublicPath: '' }; // $ExpectError