Standardize on {}|void instead of ?{} options.
This commit is contained in:
parent
597f1a12cf
commit
ca4460c0b8
@ -214,7 +214,7 @@ class OptionManager {
|
||||
|
||||
type BasicDescriptor = {
|
||||
value: {} | Function,
|
||||
options: ?{},
|
||||
options: {} | void,
|
||||
dirname: string,
|
||||
alias: string,
|
||||
loc: string,
|
||||
@ -222,7 +222,7 @@ type BasicDescriptor = {
|
||||
|
||||
type LoadedDescriptor = {
|
||||
value: {},
|
||||
options: ?{},
|
||||
options: {} | void,
|
||||
dirname: string,
|
||||
alias: string,
|
||||
loc: string,
|
||||
@ -520,7 +520,7 @@ function normalizePair(
|
||||
): {
|
||||
filepath: string | null,
|
||||
value: {} | Function,
|
||||
options: ?{},
|
||||
options: {} | void,
|
||||
} {
|
||||
let options;
|
||||
let value = pair;
|
||||
@ -562,6 +562,7 @@ function normalizePair(
|
||||
"Plugin/Preset options must be an object, null, or undefined",
|
||||
);
|
||||
}
|
||||
options = options || undefined;
|
||||
|
||||
return { filepath, value, options };
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ export default class Plugin {
|
||||
|
||||
options: {} | void;
|
||||
|
||||
constructor(plugin: {}, options: ?{}, key?: string) {
|
||||
constructor(plugin: {}, options: {} | void, key?: string) {
|
||||
if (plugin.name != null && typeof plugin.name !== "string") {
|
||||
throw new Error("Plugin .name must be a string, null, or undefined");
|
||||
}
|
||||
@ -37,6 +37,6 @@ export default class Plugin {
|
||||
this.post = plugin.post;
|
||||
this.pre = plugin.pre;
|
||||
this.visitor = plugin.visitor;
|
||||
this.options = options || undefined;
|
||||
this.options = options;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user