🤖 Merge PR #50015 @types/auto-sni: allow callback or async callback by @jankal

* @types/auto-sni: update tests

* @types/auto-sni: update type to allow callback for domains option

* fix(@types/auto-sni): add parentheses

* fix(@types/auto-sni): update test

* feat(@types/auto-sni): add dir option

* feat(@types/auto-sni): add dir to test
This commit is contained in:
Alexander Jank
2020-12-21 14:28:06 +01:00
committed by GitHub
parent 6e2ce96660
commit b1af4a2a27
2 changed files with 16 additions and 1 deletions

View File

@@ -2,5 +2,18 @@ import autosni = require("auto-sni");
const a = autosni({
agreeTos: true,
email: '',
dir: '',
domains: ['']
});
const b = autosni({
agreeTos: true,
email: '',
domains: () => []
});
const c = autosni({
agreeTos: true,
email: '',
domains: () => Promise.resolve([])
});

View File

@@ -8,10 +8,12 @@
import { Server } from "https";
declare namespace createServer {
type DomainList = Array<string | string[]>;
interface Options {
email: string;
agreeTos: boolean;
domains: Array<string | string[]>;
domains: DomainList | (() => (DomainList | Promise<DomainList>));
dir?: string;
ports?: {
http?: number,
https?: number