<commit_before>import * as React from 'react';

import {Injector, decompose, ImperativeMethodImplementation} from './injector';

export interface MixoutWrapper<P> {
  (Component: React.ComponentClass<any> | React.StatelessComponent<any>): React.ComponentClass<P>;
}

export interface Mixout {
  <P>(...injectors: Injector[]): MixoutWrapper<P>;
}

// copied from https://github.com/acdlite/recompose
function isClassComponent(Component) {
  return Boolean(Component && Component.prototype && typeof Component.prototype.isReactComponent === 'object');
}

export default (function mixout(...injectors: Injector[]) {
  const {
    ids,
    propTypeInjectors,
    contextTypeInjectors,
    propInjectors,
    initialStateInjectors,
    imperativeMethodInjectors,
    componentWillMountHooks,
    componentDidMountHooks,
    componentWillReceivePropsHooks,
    shouldComponentUpdateHooks,
    componentWillUpdateHooks,
    componentDidUpdateHooks,
    componentWillUnmountHooks,
  } = decompose(injectors);

  return function mixoutWrapper(Component: React.ComponentClass<any> | React.StatelessComponent<any>) {

    const isClass = isClassComponent(Component);

    const defaultProps: any = {};
    const propTypes: React.ValidationMap<any> = {};
    function setPropType(name: string, validator: React.Validator<any>, defaultValue: any) {
      propTypes[name] = validator;
      if (typeof defaultValue !== 'undefined') {
        defaultProps[name] = defaultValue;
      }
    };
    propTypeInjectors.forEach(propTypeInjector => propTypeInjector(setPropType));

    const contextTypes: React.ValidationMap<any> = {};
    function setContextType(name: string, validator: React.Validator<any>) {
      contextTypes[name] = validator;
    };
    contextTypeInjectors.forEach(contextTypeInjector => contextTypeInjector(setContextType));

    class Mixout extends React.Component<any, void> {
      static propTypes = propTypes;<commit_msg>Don't let defaultProps leak after override<commit_after>import * as React from 'react';

import {Injector, decompose, ImperativeMethodImplementation} from './injector';

export interface MixoutWrapper<P> {
  (Component: React.ComponentClass<any> | React.StatelessComponent<any>): React.ComponentClass<P>;
}

export interface Mixout {
  <P>(...injectors: Injector[]): MixoutWrapper<P>;
}

// copied from https://github.com/acdlite/recompose
function isClassComponent(Component) {
  return Boolean(Component && Component.prototype && typeof Component.prototype.isReactComponent === 'object');
}

export default (function mixout(...injectors: Injector[]) {
  const {
    ids,
    propTypeInjectors,
    contextTypeInjectors,
    propInjectors,
    initialStateInjectors,
    imperativeMethodInjectors,
    componentWillMountHooks,
    componentDidMountHooks,
    componentWillReceivePropsHooks,
    shouldComponentUpdateHooks,
    componentWillUpdateHooks,
    componentDidUpdateHooks,
    componentWillUnmountHooks,
  } = decompose(injectors);

  return function mixoutWrapper(Component: React.ComponentClass<any> | React.StatelessComponent<any>) {

    const isClass = isClassComponent(Component);

    const defaultProps: any = {};
    const propTypes: React.ValidationMap<any> = {};
    function setPropType(name: string, validator: React.Validator<any>, defaultValue: any) {
      propTypes[name] = validator;
      if (typeof defaultValue !== 'undefined') {
        defaultProps[name] = defaultValue;
      } else {
        delete defaultProps[name];
      }
    };
    propTypeInjectors.forEach(propTypeInjector => propTypeInjector(setPropType));

    const contextTypes: React.ValidationMap<any> = {};
    function setContextType(name: string, validator: React.Validator<any>) {
      contextTypes[name] = validator;
    };
    contextTypeInjectors.forEach(contextTypeInjector => contextTypeInjector(setContextType));

    class Mixout extends React.Component<any, void> {
      static propTypes = propTypes;
{'fraction_non_alphanumeric': 0.10843678743349379, 'fraction_numerical': 0.0, 'mean_word_length': 4.7635036496350365, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4805357', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1125, 'n_words': 219}