From fa1f81e91062e9de6161708209cd7354733aa354 Mon Sep 17 00:00:00 2001 From: AjiTae Date: Tue, 30 Mar 2021 12:41:10 +0300 Subject: [PATCH] fix(props): support BigInt in props type validation (#11191) --- src/core/util/props.js | 2 +- test/unit/features/options/props.spec.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/util/props.js b/src/core/util/props.js index 647813c5393..5a90f21b5f0 100644 --- a/src/core/util/props.js +++ b/src/core/util/props.js @@ -147,7 +147,7 @@ function assertProp ( } } -const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/ +const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/ function assertType (value: any, type: Function, vm: ?Component): { valid: boolean; diff --git a/test/unit/features/options/props.spec.js b/test/unit/features/options/props.spec.js index 94c03f1ec9f..2ada45a0553 100644 --- a/test/unit/features/options/props.spec.js +++ b/test/unit/features/options/props.spec.js @@ -252,6 +252,16 @@ describe('Options props', () => { expect('Expected String, Number, got Symbol').toHaveBeenWarned() }) } + + if (typeof BigInt !== 'undefined') { + /* global BigInt */ + it('bigint', () => { + makeInstance(BigInt(100), BigInt) + expect(console.error.calls.count()).toBe(0) + makeInstance({}, BigInt) + expect('Expected BigInt, got Object').toHaveBeenWarned() + }) + } it('custom constructor', () => { function Class () {}