Skip to content

Commit

Permalink
feat(runtime-core): props type support BigInt (#2891)
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Feb 3, 2021
1 parent de7f9d1 commit ffd5288
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions packages/runtime-core/__tests__/componentProps.spec.ts
Expand Up @@ -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>')
})
})
2 changes: 1 addition & 1 deletion packages/runtime-core/src/componentProps.ts
Expand Up @@ -510,7 +510,7 @@ function validateProp(
}

const isSimpleType = /*#__PURE__*/ makeMap(
'String,Number,Boolean,Function,Symbol'
'String,Number,Boolean,Function,Symbol,BigInt'
)

type AssertionResult = {
Expand Down

0 comments on commit ffd5288

Please sign in to comment.