diff --git a/package.json b/package.json
index 3669ab9..e352e42 100644
--- a/package.json
+++ b/package.json
@@ -38,6 +38,13 @@
"stream-to-it": "^0.2.0"
},
"devDependencies": {
+ "@types/chai": "^4.2.11",
+ "@types/chai-as-promised": "^7.1.2",
+ "@types/dirty-chai": "^2.0.2",
+ "@types/fs-extra": "^8.1.0",
+ "@types/it-all": "^1.0.0",
+ "@types/node": "^13.9.3",
+ "@types/node-fetch": "^2.5.5",
"aegir": "^21.4.2",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
diff --git a/src/env.d.ts b/src/env.d.ts
new file mode 100644
index 0000000..b03177b
--- /dev/null
+++ b/src/env.d.ts
@@ -0,0 +1,12 @@
+declare const IS_TEST: boolean;
+declare const IS_ELECTRON: any;
+declare const IS_ELECTRON_MAIN: boolean;
+declare const IS_ELECTRON_RENDERER: boolean;
+declare const IS_NODE: boolean;
+/**
+ * Detects browser main thread **NOT** web worker or service worker
+ */
+declare const IS_BROWSER: boolean;
+declare const IS_WEBWORKER: boolean;
+declare const IS_ENV_WITH_DOM: boolean;
+export { IS_TEST as isTest, IS_ELECTRON as isElectron, IS_ELECTRON_MAIN as isElectronMain, IS_ELECTRON_RENDERER as isElectronRenderer, IS_NODE as isNode, IS_BROWSER as isBrowser, IS_WEBWORKER as isWebWorker, IS_ENV_WITH_DOM as isEnvWithDom };
diff --git a/src/files/format-mode.d.ts b/src/files/format-mode.d.ts
new file mode 100644
index 0000000..008c0c6
--- /dev/null
+++ b/src/files/format-mode.d.ts
@@ -0,0 +1,2 @@
+export = formatMode;
+declare function formatMode(mode: number, isDirectory: boolean): string;
diff --git a/src/files/format-mode.js b/src/files/format-mode.js
index f25ae5c..cab76af 100644
--- a/src/files/format-mode.js
+++ b/src/files/format-mode.js
@@ -16,6 +16,13 @@ const S_IROTH = parseInt('4', 8) // others have read permission
const S_IWOTH = parseInt('2', 8) // others have write permission
const S_IXOTH = parseInt('1', 8) // others have execute permission
+/**
+ *
+ * @param {number} mode
+ * @param {number} perm
+ * @param {string} type
+ * @param {string[]} output
+ */
function checkPermission (mode, perm, type, output) {
if ((mode & perm) === perm) {
output.push(type)
@@ -24,6 +31,12 @@ function checkPermission (mode, perm, type, output) {
}
}
+/**
+ *
+ * @param {number} mode
+ * @param {boolean} isDirectory
+ * @returns {string}
+ */
function formatMode (mode, isDirectory) {
const output = []
diff --git a/src/files/format-mtime.d.ts b/src/files/format-mtime.d.ts
new file mode 100644
index 0000000..e5c6175
--- /dev/null
+++ b/src/files/format-mtime.d.ts
@@ -0,0 +1,2 @@
+export = formatMtime;
+declare function formatMtime(mtime: { secs: number, nsecs: number }): string;
diff --git a/src/files/glob-source.d.ts b/src/files/glob-source.d.ts
new file mode 100644
index 0000000..f7c1321
--- /dev/null
+++ b/src/files/glob-source.d.ts
@@ -0,0 +1,24 @@
+///
+import { ReadStream } from "fs";
+/**
+* Create an async iterator that yields paths that match requested file paths.
+*
+* @param {Iterable|AsyncIterable|String} paths File system path(s) to glob from
+* @param {Object} [options] Optional options
+* @param {Boolean} [options.recursive] Recursively glob all paths in directories
+* @param {Boolean} [options.hidden] Include .dot files in matched paths
+* @param {Array} [options.ignore] Glob paths to ignore
+* @param {Boolean} [options.followSymlinks] follow symlinks
+* @param {Boolean} [options.preserveMode] preserve mode
+* @param {Boolean} [options.preserveMtime] preserve mtime
+* @param {Boolean} [options.mode] mode to use - if preserveMode is true this will be ignored
+* @param {Boolean} [options.mtime] mtime to use - if preserveMtime is true this will be ignored
+* @yields {{ path: String, content: AsyncIterator }} File objects in the form `{ path: String, content: AsyncIterator }`
+*/
+declare function globSource(paths: Iterable | AsyncIterable | string, options: any): AsyncGenerator<{
+ path: string;
+ content?: ReadStream;
+ mode: number;
+ mtime: number;
+}>;
+export = globSource;
diff --git a/src/files/normalise-input.d.ts b/src/files/normalise-input.d.ts
new file mode 100644
index 0000000..99b2fe1
--- /dev/null
+++ b/src/files/normalise-input.d.ts
@@ -0,0 +1,6 @@
+declare function _exports(input: any): AsyncGenerator<{
+ path: string;
+ mode: number;
+ mtime: number;
+}>;
+export = _exports;
diff --git a/src/files/url-source.d.ts b/src/files/url-source.d.ts
new file mode 100644
index 0000000..eb5babd
--- /dev/null
+++ b/src/files/url-source.d.ts
@@ -0,0 +1,5 @@
+declare function _exports(url: any, options: any): AsyncGenerator<{
+ path: string;
+ content: AsyncGenerator;
+}>;
+export = _exports;
diff --git a/src/globalthis.d.ts b/src/globalthis.d.ts
new file mode 100644
index 0000000..73d760f
--- /dev/null
+++ b/src/globalthis.d.ts
@@ -0,0 +1,2 @@
+declare const _exports: typeof globalThis;
+export = _exports;
diff --git a/src/http.d.ts b/src/http.d.ts
new file mode 100644
index 0000000..209ab32
--- /dev/null
+++ b/src/http.d.ts
@@ -0,0 +1,141 @@
+export = HTTP;
+/**
+ * @typedef {Object} APIOptions - creates a new type named 'SpecialType'
+ * @prop {any} [body] - Request body
+ * @prop {string} [method] - GET, POST, PUT, DELETE, etc.
+ * @prop {string} [base] - The base URL to use in case url is a relative URL
+ * @prop {Headers|Record} [headers] - Request header.
+ * @prop {number} [timeout] - Amount of time until request should timeout in ms.
+ * @prop {AbortSignal} [signal] - Signal to abort the request.
+ * @prop {URLSearchParams|Object} [searchParams] - URL search param.
+ * @prop {string} [credentials]
+ * @prop {boolean} [throwHttpErrors]
+ * @prop {function(URLSearchParams): URLSearchParams } [transformSearchParams]
+ * @prop {function(any): any} [transform] - When iterating the response body, transform each chunk with this function.
+ * @prop {function(Response): Promise} [handleError] - Handle errors
+ */
+declare class HTTP {
+ /**
+ *
+ * @param {APIOptions} options
+ */
+ constructor(options?: APIOptions);
+ /** @type {APIOptions} */
+ opts: APIOptions;
+ abortController: any;
+ /**
+ * Fetch
+ *
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {Promise}
+ */
+ fetch(resource: string | Request | URL, options?: APIOptions): Promise;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {Promise}
+ */
+ post(resource: string | Request | URL, options?: APIOptions): Promise;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {Promise}
+ */
+ get(resource: string | Request | URL, options?: APIOptions): Promise;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {Promise}
+ */
+ put(resource: string | Request | URL, options?: APIOptions): Promise;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {Promise}
+ */
+ delete(resource: string | Request | URL, options?: APIOptions): Promise;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {Promise}
+ */
+ options(resource: string | Request | URL, options?: APIOptions): Promise;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {Promise>}
+ */
+ stream(resource: string | Request | URL, options?: APIOptions): Promise>;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {AsyncGenerator}
+ */
+ iterator(resource: string | Request | URL, options?: APIOptions): AsyncGenerator;
+ /**
+ * @param {string | URL | Request} resource
+ * @param {APIOptions} options
+ * @returns {AsyncGenerator