Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("raises error when called with incorrect arguments", () => {
// $ExpectError - too few arguments
loadNamespaces();
// $ExpectError - wrong type
loadNamespaces("");
// $ExpectError - wrong components type
loadNamespaces({ components: [{}], i18n });
});
});
} />;
// $ExpectError - missing children prop
;
// $ExpectError - missing i18n prop
} />;
// passing
loadNamespaces({ components: [], i18n });
loadNamespaces({ components: [() => <div>], i18n });
// $ExpectError - too few arguments
loadNamespaces();
// $ExpectError - wrong type
loadNamespaces("");
// $ExpectError - wrong component type
loadNamespaces({ components: [{}], i18n });
type OwnProps = { s: string };
type Props = OwnProps & { t: TFunction };
const Comp = ({ s, t }: Props) => <div>;
class ClassComp extends React.Component {
render() {
const { s, t } = this.props;
return <div>;
}
}
// $ExpectError - wrong argument type</div></div></div>
} />;
// $ExpectError - missing children prop
;
// $ExpectError - missing i18n prop
} />;
// passing
loadNamespaces({ components: [], i18n });
loadNamespaces({ components: [() => <div>], i18n });
// $ExpectError - too few arguments
loadNamespaces();
// $ExpectError - wrong type
loadNamespaces("");
// $ExpectError - wrong component type
loadNamespaces({ components: [{}], i18n });
type OwnProps = { s: string };
type Props = OwnProps & { t: TFunction };
const Comp = ({ s, t }: Props) => <div>;
class ClassComp extends React.Component {
render() {
const { s, t } = this.props;
return <div>;
}
}
// $ExpectError - wrong argument type</div></div></div>
render() {
return (
<div>
<main>
</main>
</div>
);
}
}
;
loadNamespaces({ components: [App], i18n }).then(() => { }).catch(error => { });
;
;
;
type Key = "view" | "nav";
class GenericsTest extends React.Component {
render() { return null; }
}
translate(['view', 'nav'])(GenericsTest);
class GenericsTest2 extends React.Component {