Skip to content

Commit fa1f81e

Browse files
authored
fix(props): support BigInt in props type validation (#11191)
1 parent c42b706 commit fa1f81e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/core/util/props.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function assertProp (
147147
}
148148
}
149149

150-
const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/
150+
const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/
151151

152152
function assertType (value: any, type: Function, vm: ?Component): {
153153
valid: boolean;

test/unit/features/options/props.spec.js

+10
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ describe('Options props', () => {
252252
expect('Expected String, Number, got Symbol').toHaveBeenWarned()
253253
})
254254
}
255+
256+
if (typeof BigInt !== 'undefined') {
257+
/* global BigInt */
258+
it('bigint', () => {
259+
makeInstance(BigInt(100), BigInt)
260+
expect(console.error.calls.count()).toBe(0)
261+
makeInstance({}, BigInt)
262+
expect('Expected BigInt, got Object').toHaveBeenWarned()
263+
})
264+
}
255265

256266
it('custom constructor', () => {
257267
function Class () {}

0 commit comments

Comments
 (0)