File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,12 @@ export function diffChildren(
5353 // If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,
5454 // or we are rendering a component (e.g. setState) copy the oldVNodes so it can have
5555 // it's own DOM & etc. pointers
56- else if ( typeof childVNode == 'string' || typeof childVNode == 'number' ) {
56+ else if (
57+ typeof childVNode == 'string' ||
58+ typeof childVNode == 'number' ||
59+ // eslint-disable-next-line valid-typeof
60+ typeof childVNode == 'bigint'
61+ ) {
5762 childVNode = newParentVNode . _children [ i ] = createVNode (
5863 null ,
5964 childVNode ,
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ declare namespace preact {
4848 | object
4949 | string
5050 | number
51+ | bigint
5152 | boolean
5253 | null
5354 | undefined ;
Original file line number Diff line number Diff line change @@ -256,6 +256,17 @@ describe('render()', () => {
256256 expect ( scratch . innerHTML ) . to . equal ( '42' ) ;
257257 } ) ;
258258
259+ it ( 'should render bigint as text content' , ( ) => {
260+ // Skip in browsers not supporting big integers
261+ if ( typeof BigInt === 'undefined' ) {
262+ return ;
263+ }
264+
265+ // eslint-disable-next-line no-undef, new-cap
266+ render ( BigInt ( 4 ) , scratch ) ;
267+ expect ( scratch . innerHTML ) . to . equal ( '4' ) ;
268+ } ) ;
269+
259270 it ( 'should render strings as text content' , ( ) => {
260271 render ( 'Testing, huh! How is it going?' , scratch ) ;
261272 expect ( scratch . innerHTML ) . to . equal ( 'Testing, huh! How is it going?' ) ;
You can’t perform that action at this time.
0 commit comments