dillon1000/react

Commit

Type Transaction (#7581)

This one is interesting because we have transaction objects being passed around everywhere in the codebase but there's actually no Transaction class. It's a "mixin" that comes to life by being Object.assigned to the prototype of a real "class" (before class was cool!). Therefore, we can't just say `var Transaction = require('Transaction'); (transaction: Transaction) => { }` because it would be the object that contains a mixin and not an instance of a transaction.

The trick I use is to export `TransactionType` and alias it to `Transaction` in the file as it doesn't actually require transaction. In case they do, we'll figure it out, but in the few files I looked at, it doesn't seem to be the case.

For the perform function, it actually typechecks pretty well!
Browse files
Changed paths9 files
First-parent comparison
M src/renderers/dom/client/ReactReconcileTransaction.js ModifiedM src/renderers/dom/server/ReactServerRenderingTransaction.js ModifiedM src/renderers/dom/server/ReactServerUpdateQueue.js ModifiedM src/renderers/native/ReactNativeReconcileTransaction.js ModifiedM src/renderers/shared/stack/reconciler/ReactDefaultBatchingStrategy.js ModifiedM src/renderers/shared/stack/reconciler/ReactUpdates.js ModifiedM src/renderers/shared/utils/Transaction.js ModifiedM src/renderers/shared/utils/__tests__/Transaction-test.js ModifiedM src/renderers/testing/ReactTestReconcileTransaction.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…