diff --git a/src/core/util/props.js b/src/core/util/props.js index 5cf5e166..36acf6a2 100644 --- a/src/core/util/props.js +++ b/src/core/util/props.js @@ -91,7 +91,7 @@ function assertProp ( return } let type = prop.type - let valid = !type + let valid = !type || type === true const expectedTypes = [] if (type) { if (!Array.isArray(type)) { diff --git a/test/unit/features/options/props.spec.js b/test/unit/features/options/props.spec.js index efcec3f2..e0d2f08f 100644 --- a/test/unit/features/options/props.spec.js +++ b/test/unit/features/options/props.spec.js @@ -244,6 +244,19 @@ describe('Options props', () => { expect(console.error.calls.count()).toBe(2) expect('Expected Boolean').toHaveBeenWarned() }) + + it('optional prop of any type (type: true or prop: true)', () => { + makeInstance(1, true) + expect(console.error.calls.count()).toBe(0) + makeInstance('any', true) + expect(console.error.calls.count()).toBe(0) + makeInstance({}, true) + expect(console.error.calls.count()).toBe(0) + makeInstance(undefined, true) + expect(console.error.calls.count()).toBe(0) + makeInstance(null, true) + expect(console.error.calls.count()).toBe(0) + }) }) it('should warn data fields already defined as a prop', () => {