Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit a894030

Browse files
steveluscherfacebook-github-bot
authored andcommitted
Make the Flow type of CompositeDraftDecorator's constructor more strict
Summary: The input array of decorators gets cloned in the constructor to prevent mutations of the original array from affecting the composite. Another way to communicate that the input array should not be mutated is with the `$ReadOnlyArray<...>` Flow type. Reviewed By: kassens Differential Revision: D6882262 fbshipit-source-id: 35bfb957a7d006d5554d6ba11ba7d095800d40b0
1 parent 7017825 commit a894030

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/model/decorators/CompositeDraftDecorator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ var DELIMITER = '.';
4343
* preserved and the new match is discarded.
4444
*/
4545
class CompositeDraftDecorator {
46-
_decorators: Array<DraftDecorator>;
46+
_decorators: $ReadOnlyArray<DraftDecorator>;
4747

48-
constructor(decorators: Array<DraftDecorator>) {
48+
constructor(decorators: $ReadOnlyArray<DraftDecorator>) {
4949
// Copy the decorator array, since we use this array order to determine
5050
// precedence of decoration matching. If the array is mutated externally,
5151
// we don't want to be affected here.

0 commit comments

Comments
 (0)