Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(props): support BigInt in props type validation (#11191)
  • Loading branch information
AjiTae committed Mar 30, 2021
1 parent c42b706 commit fa1f81e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/util/props.js
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions test/unit/features/options/props.spec.js
Expand Up @@ -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 () {}
Expand Down

0 comments on commit fa1f81e

Please sign in to comment.