Skip to content

Commit

Permalink
Adding side effect annotations (#2999)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgperry authored Jan 14, 2025
1 parent bbb3b5c commit c5898f5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/motion-utils/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ if (process.env.NODE_ENV !== "production") {
}
}

export { warning, invariant }
export { invariant, warning }
1 change: 1 addition & 0 deletions packages/motion-utils/src/memo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*#__NO_SIDE_EFFECTS__*/
export function memo<T extends any>(callback: () => T) {
let result: T | undefined

Expand Down
1 change: 1 addition & 0 deletions packages/motion-utils/src/noop.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/*#__NO_SIDE_EFFECTS__*/
export const noop = <T>(any: T): T => any
1 change: 1 addition & 0 deletions packages/motion-utils/src/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@param [number]: Value to find progress within given range
@return [number]: Progress of value within range as expressed 0-1
*/
/*#__NO_SIDE_EFFECTS__*/
export const progress = (from: number, to: number, value: number) => {
const toFromDifference = to - from

Expand Down
3 changes: 3 additions & 0 deletions packages/motion-utils/src/time-conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/

/*#__NO_SIDE_EFFECTS__*/
export const secondsToMilliseconds = (seconds: number) => seconds * 1000

/*#__NO_SIDE_EFFECTS__*/
export const millisecondsToSeconds = (milliseconds: number) =>
milliseconds / 1000

0 comments on commit c5898f5

Please sign in to comment.