Skip to content

Commit c9f94fa

Browse files
authored
feat(compiler-core): support BigInt in template (#2900)
1 parent dd02cf3 commit c9f94fa

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/shared/src/globalsWhitelist.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { makeMap } from './makeMap'
33
const GLOBALS_WHITE_LISTED =
44
'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
55
'decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,' +
6-
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl'
6+
'Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt'
77

88
export const isGloballyWhitelisted = /*#__PURE__*/ makeMap(GLOBALS_WHITE_LISTED)

packages/vue/__tests__/index.spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,13 @@ describe('compiler + runtime integration', () => {
292292
createApp(App).mount(container)
293293
expect(EMPTY_ARR.length).toBe(0)
294294
})
295+
296+
test('BigInt support', () => {
297+
const app = createApp({
298+
template: `<div>{{ BigInt(BigInt(100000111)) + BigInt(2000000000n) * 30000000n }}</div>`
299+
})
300+
const root = document.createElement('div')
301+
app.mount(root)
302+
expect(root.innerHTML).toBe('<div>60000000100000111</div>')
303+
})
295304
})

0 commit comments

Comments
 (0)