fix(inject): allow default value to be undefined (#894)

Close #892
This commit is contained in:
Eduardo San Martin Morote
2020-03-30 21:24:55 +02:00
committed by GitHub
parent 573bcb2e11
commit 94562daea7
2 changed files with 24 additions and 1 deletions

View File

@@ -40,7 +40,7 @@ export function inject(
if (key in provides) {
// TS doesn't allow symbol as index type
return provides[key as string]
} else if (defaultValue !== undefined) {
} else if (arguments.length > 1) {
return defaultValue
} else if (__DEV__) {
warn(`injection "${String(key)}" not found.`)