Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(props): support BigInt in props type validation #11191

Merged
merged 1 commit into from Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/util/props.js
Expand Up @@ -146,7 +146,7 @@ function assertProp (
}
}

const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/
const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/

function assertType (value: any, type: Function): {
valid: boolean;
Expand Down
10 changes: 10 additions & 0 deletions test/unit/features/options/props.spec.js
Expand Up @@ -242,6 +242,16 @@ describe('Options props', () => {
expect('Expected Symbol, got Object').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