@@ -325,6 +325,9 @@ describe('PropTypesDevelopmentStandalone', () => {
325
325
326
326
it ( 'should not warn for valid values' , ( ) => {
327
327
typeCheckPass ( PropTypes . array , [ ] ) ;
328
+ if ( typeof BigInt === 'function' ) {
329
+ typeCheckPass ( PropTypes . bigint , BigInt ( 0 ) ) ;
330
+ }
328
331
typeCheckPass ( PropTypes . bool , false ) ;
329
332
typeCheckPass ( PropTypes . func , function ( ) { } ) ;
330
333
typeCheckPass ( PropTypes . number , 0 ) ;
@@ -345,6 +348,7 @@ describe('PropTypesDevelopmentStandalone', () => {
345
348
typeCheckFailRequiredValues ( PropTypes . array . isRequired ) ;
346
349
typeCheckFailRequiredValues ( PropTypes . symbol . isRequired ) ;
347
350
typeCheckFailRequiredValues ( PropTypes . number . isRequired ) ;
351
+ typeCheckFailRequiredValues ( PropTypes . bigint . isRequired ) ;
348
352
typeCheckFailRequiredValues ( PropTypes . bool . isRequired ) ;
349
353
typeCheckFailRequiredValues ( PropTypes . func . isRequired ) ;
350
354
typeCheckFailRequiredValues ( PropTypes . shape ( { } ) . isRequired ) ;
@@ -358,6 +362,15 @@ describe('PropTypesDevelopmentStandalone', () => {
358
362
expectThrowsInDevelopment ( PropTypes . array . isRequired , [ ] ) ;
359
363
expectThrowsInDevelopment ( PropTypes . array . isRequired , null ) ;
360
364
expectThrowsInDevelopment ( PropTypes . array . isRequired , undefined ) ;
365
+ expectThrowsInDevelopment ( PropTypes . bigint , function ( ) { } ) ;
366
+ expectThrowsInDevelopment ( PropTypes . bigint , 42 ) ;
367
+ if ( typeof BigInt === 'function' ) {
368
+ expectThrowsInDevelopment ( PropTypes . bigint , BigInt ( 42 ) ) ;
369
+ }
370
+ expectThrowsInDevelopment ( PropTypes . bigint . isRequired , function ( ) { } ) ;
371
+ expectThrowsInDevelopment ( PropTypes . bigint . isRequired , 42 ) ;
372
+ expectThrowsInDevelopment ( PropTypes . bigint . isRequired , null ) ;
373
+ expectThrowsInDevelopment ( PropTypes . bigint . isRequired , undefined ) ;
361
374
expectThrowsInDevelopment ( PropTypes . bool , [ ] ) ;
362
375
expectThrowsInDevelopment ( PropTypes . bool , true ) ;
363
376
expectThrowsInDevelopment ( PropTypes . bool . isRequired , [ ] ) ;
@@ -433,6 +446,9 @@ describe('PropTypesDevelopmentStandalone', () => {
433
446
434
447
it ( 'should support the arrayOf propTypes' , ( ) => {
435
448
typeCheckPass ( PropTypes . arrayOf ( PropTypes . number ) , [ 1 , 2 , 3 ] ) ;
449
+ if ( typeof BigInt === 'function' ) {
450
+ typeCheckPass ( PropTypes . arrayOf ( PropTypes . bigint ) , [ BigInt ( 1 ) , BigInt ( 2 ) , BigInt ( 3 ) ] ) ;
451
+ }
436
452
typeCheckPass ( PropTypes . arrayOf ( PropTypes . string ) , [ 'a' , 'b' , 'c' ] ) ;
437
453
typeCheckPass ( PropTypes . arrayOf ( PropTypes . oneOf ( [ 'a' , 'b' ] ) ) , [ 'a' , 'b' ] ) ;
438
454
typeCheckPass ( PropTypes . arrayOf ( PropTypes . symbol ) , [ Symbol ( ) , Symbol ( ) ] ) ;
@@ -536,7 +552,6 @@ describe('PropTypesDevelopmentStandalone', () => {
536
552
} ) ;
537
553
538
554
describe ( 'Component Type' , ( ) => {
539
-
540
555
it ( 'should support components' , ( ) => {
541
556
typeCheckPass ( PropTypes . element , < div /> ) ;
542
557
} ) ;
@@ -554,6 +569,14 @@ describe('PropTypesDevelopmentStandalone', () => {
554
569
'Invalid prop `testProp` of type `number` supplied to `testComponent`, ' +
555
570
'expected a single ReactElement.' ,
556
571
) ;
572
+ if ( typeof BigInt === 'function' ) {
573
+ typeCheckFail (
574
+ PropTypes . element ,
575
+ BigInt ( 123 ) ,
576
+ 'Invalid prop `testProp` of type `bigint` supplied to `testComponent`, ' +
577
+ 'expected a single ReactElement.' ,
578
+ ) ;
579
+ }
557
580
typeCheckFail (
558
581
PropTypes . element ,
559
582
'foo' ,
0 commit comments