Repository: facebook/react
File: packages/react-reconciler/src/ReactFiberClassComponent.js (JavaScript)

Code before:
    // If shouldComponentUpdate returned false, we should still update the
    // memoized props/state to indicate that this work can be reused.
    workInProgress.memoizedProps = newProps;
    workInProgress.memoizedState = newState;
  }

  // Update the existing instance's state, props, and context pointers even
  // if shouldComponentUpdate returns false.
  instance.props = newProps;
  instance.state = newState;
  instance.context = nextContext;

  return shouldUpdate;
}

export function resolveClassComponentProps(
  Component: any,
  baseProps: Object,
  // Only resolve default props if this is a lazy component. Otherwise, they
  // would have already been resolved by the JSX runtime.
  // TODO: We're going to remove default prop resolution from the JSX runtime
  // and keep it only for class components. As part of that change, we should
  // remove this extra check.
  alreadyResolvedDefaultProps: boolean,
): Object {
  let newProps = baseProps;

  if (enableRefAsProp) {
    // Remove ref from the props object, if it exists.
    if ('ref' in baseProps) {
      newProps = ({}: typeof baseProps);
      for (const propName in baseProps) {
        if (propName !== 'ref') {
          newProps[propName] = baseProps[propName];
        }
      }
    }
  }

  // Resolve default props.
  const defaultProps = Component.defaultProps;
  if (
    defaultProps &&
    // If disableDefaultPropsExceptForClasses is true, we always resolve
    // default props here in the reconciler, rather than in the JSX runtime.
    (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps)
  ) {
    // We may have already copied the props object above to remove ref. If so,
    // we can modify that. Otherwise, copy the props object with Object.assign.
    if (newProps === baseProps) {
      newProps = assign({}, newProps, baseProps);

Review comment (suggestion):
You can just be explicit here with the types, `Object` is just an alias for `any`.

```suggestion
  let newProps: any = baseProps;
```

Code after:
    // If shouldComponentUpdate returned false, we should still update the
    // memoized props/state to indicate that this work can be reused.
    workInProgress.memoizedProps = newProps;
    workInProgress.memoizedState = newState;
  }

  // Update the existing instance's state, props, and context pointers even
  // if shouldComponentUpdate returns false.
  instance.props = newProps;
  instance.state = newState;
  instance.context = nextContext;

  return shouldUpdate;
}

export function resolveClassComponentProps(
  Component: any,
  baseProps: Object,
  // Only resolve default props if this is a lazy component. Otherwise, they
  // would have already been resolved by the JSX runtime.
  // TODO: We're going to remove default prop resolution from the JSX runtime
  // and keep it only for class components. As part of that change, we should
  // remove this extra check.
  alreadyResolvedDefaultProps: boolean,
): Object {
  let newProps = baseProps;

  if (enableRefAsProp) {
    // Remove ref from the props object, if it exists.
    if ('ref' in baseProps) {
      newProps = ({}: any);
      for (const propName in baseProps) {
        if (propName !== 'ref') {
          newProps[propName] = baseProps[propName];
        }
      }
    }
  }

  // Resolve default props.
  const defaultProps = Component.defaultProps;
  if (
    defaultProps &&
    // If disableDefaultPropsExceptForClasses is true, we always resolve
    // default props here in the reconciler, rather than in the JSX runtime.
    (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps)
  ) {
    // We may have already copied the props object above to remove ref. If so,
    // we can modify that. Otherwise, copy the props object with Object.assign.
    if (newProps === baseProps) {
      newProps = assign({}, newProps, baseProps);