Fixed null error in plugin opts and added a test for it (#9945)

* Fixed null error in plugin opts and added a test for it

* Remove !opts and add opts === null check to avoid confusion with false and undefined cases

Co-Authored-By: divbhasin <divbest99@gmail.com>
This commit is contained in:
Divyam Bhasin
2019-05-07 10:23:01 -04:00
committed by Nicolò Ribaudo
parent 354666aa17
commit 7942dc0f07
2 changed files with 12 additions and 2 deletions

View File

@@ -337,7 +337,7 @@ function assertPluginItem(loc: GeneralPath, value: mixed): PluginItem {
if (
opts !== undefined &&
opts !== false &&
(typeof opts !== "object" || Array.isArray(opts))
(typeof opts !== "object" || Array.isArray(opts) || opts === null)
) {
throw new Error(
`${msg(access(loc, 1))} must be an object, false, or undefined`,