File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,12 @@ export function diffChildren(
53
53
// If this newVNode is being reused (e.g. <div>{reuse}{reuse}</div>) in the same diff,
54
54
// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have
55
55
// 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
+ ) {
57
62
childVNode = newParentVNode . _children [ i ] = createVNode (
58
63
null ,
59
64
childVNode ,
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ declare namespace preact {
48
48
| object
49
49
| string
50
50
| number
51
+ | bigint
51
52
| boolean
52
53
| null
53
54
| undefined ;
Original file line number Diff line number Diff line change @@ -256,6 +256,17 @@ describe('render()', () => {
256
256
expect ( scratch . innerHTML ) . to . equal ( '42' ) ;
257
257
} ) ;
258
258
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
+
259
270
it ( 'should render strings as text content' , ( ) => {
260
271
render ( 'Testing, huh! How is it going?' , scratch ) ;
261
272
expect ( scratch . innerHTML ) . to . equal ( 'Testing, huh! How is it going?' ) ;
You can’t perform that action at this time.
0 commit comments