feat(runtime-core): props type support BigInt (#2891)

This commit is contained in:
edison 2021-02-04 02:25:45 +08:00 committed by GitHub
parent de7f9d1efd
commit ffd5288545
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -378,4 +378,25 @@ describe('component props', () => {
expect(setupProps).toMatchObject(props)
expect(renderProxy.$props).toMatchObject(props)
})
test('props type support BigInt', () => {
const Comp = {
props: {
foo: BigInt
},
render(this: any) {
return h('div', [this.foo])
}
}
const root = nodeOps.createElement('div')
render(
h(Comp, {
foo: BigInt(BigInt(100000111)) + BigInt(2000000000) * BigInt(30000000)
}),
root
)
expect(serializeInner(root)).toMatch('<div>60000000100000111</div>')
})
})

View File

@ -510,7 +510,7 @@ function validateProp(
}
const isSimpleType = /*#__PURE__*/ makeMap(
'String,Number,Boolean,Function,Symbol'
'String,Number,Boolean,Function,Symbol,BigInt'
)
type AssertionResult = {