more accurate importer definition

- sync and async variants
- return object declares either `file` or `contents`, not both
- can also return Error to throw or `null` to opt out of handling path
This commit is contained in:
Gilad Gray
2016-11-22 23:33:26 -08:00
committed by GitHub
parent e8d8a70438
commit 5b78db64d3
+3 -1
View File
@@ -5,9 +5,11 @@
/// <reference types="node" />
type ImporterReturnType = { file: string } | { contents: string } | Error | null;
interface Importer {
(url: string, prev: string, done: (data: { file: string; contents: string; }) => void): void;
(url: string, prev: string): ImporterReturnType;
(url: string, prev: string, done: (data: ImporterReturnType) => void): void;
}
interface Options {