@samitouri / QOS-React / commits / 488b973d68

Use number type for bitfields

Unions don't enumerate all the possible combinations of bitfields. I'm not actually sure why this was type-checking before. number doesn't provide much safety but it's more correct.

Andrew Clark committed Apr 18, 2017 at 15:58 UTC 488b973d6838610a8f651d1c812fa82d74cf8bbd
2 files changed +10 -10
src/renderers/shared/fiber/ReactTypeOfInternalContext.js
+1 -1
@@ -12,7 +12,7 @@
12
13 'use strict';
14
15 -export type TypeOfInternalContext = 0 | 1;
15 +export type TypeOfInternalContext = number;
16
17 module.exports = {
18 NoContext: 0,
src/renderers/shared/fiber/ReactTypeOfSideEffect.js
+9 -9
@@ -12,16 +12,16 @@
12
13 'use strict';
14
15 -export type TypeOfSideEffect = 0 | 1 | 2 | 3 | 4 | 8 | 16 | 32 | 64;
15 +export type TypeOfSideEffect = number;
16
17 module.exports = {
18 - NoEffect: 0, // 0b0000000
19 - Placement: 1, // 0b0000001
20 - Update: 2, // 0b0000010
18 + NoEffect: 0, // 0b0000000
19 + Placement: 1, // 0b0000001
20 + Update: 2, // 0b0000010
21 PlacementAndUpdate: 3, // 0b0000011
22 - Deletion: 4, // 0b0000100
23 - ContentReset: 8, // 0b0001000
24 - Callback: 16, // 0b0010000
25 - Err: 32, // 0b0100000
26 - Ref: 64, // 0b1000000
22 + Deletion: 4, // 0b0000100
23 + ContentReset: 8, // 0b0001000
24 + Callback: 16, // 0b0010000
25 + Err: 32, // 0b0100000
26 + Ref: 64, // 0b1000000
27 };