Skip to content

Commit

Permalink
Make TimingAnimationConfig read-only
Browse files Browse the repository at this point in the history
Summary:
Makes `TimingAnimationConfig` read-only, as it's purely an input type.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D34146703

fbshipit-source-id: 77ac7ee0641a869b62e5f95b6a7f711c71e82c7d
  • Loading branch information
motiz88 authored and facebook-github-bot committed Feb 11, 2022
1 parent 1aec881 commit 4cd50ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Libraries/Animated/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const diffClamp = function (

const _combineCallbacks = function (
callback: ?EndCallback,
config: {...AnimationConfig, ...},
config: $ReadOnly<{...AnimationConfig, ...}>,
) {
if (callback && config.onComplete) {
return (...args) => {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/NativeAnimatedHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function assertNativeAnimatedModule(): void {
let _warnedMissingNativeAnimated = false;

function shouldUseNativeDriver(
config: {...AnimationConfig, ...} | EventConfig,
config: $ReadOnly<{...AnimationConfig, ...}> | EventConfig,
): boolean {
if (config.useNativeDriver == null) {
console.warn(
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Animated/animations/TimingAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {RgbaValue} from '../nodes/AnimatedColor';

import AnimatedColor from '../nodes/AnimatedColor';

export type TimingAnimationConfig = {
export type TimingAnimationConfig = $ReadOnly<{
...AnimationConfig,
toValue:
| number
Expand All @@ -40,15 +40,15 @@ export type TimingAnimationConfig = {
easing?: (value: number) => number,
duration?: number,
delay?: number,
};
}>;

export type TimingAnimationConfigSingle = {
export type TimingAnimationConfigSingle = $ReadOnly<{
...AnimationConfig,
toValue: number | AnimatedValue | AnimatedInterpolation,
easing?: (value: number) => number,
duration?: number,
delay?: number,
};
}>;

let _easeInOut;
function easeInOut() {
Expand Down

0 comments on commit 4cd50ae

Please sign in to comment.