import * as intl from 'enzyme-react-intl'; import * as React from 'react'; class SampleComponent extends React.Component { render() { return
Sample
; } } interface Props { id: number; } interface State { constructed: boolean; } class PropsComponent extends React.Component { render() { return
{this.props.id}
; } } class StateComponent extends React.Component<{}, State> { constructor(props: {}) { super(props); this.state = { constructed: true }; } render() { return
{this.state.constructed ? 'Constructed' : 'Not constructed'}
; } } class StatePropsComponent extends React.Component { constructor(props: Props) { super(props); this.state = { constructed: true }; } render() { return (
{this.state.constructed ? 'Constructed' : 'Not constructed'}
{this.props.id}
); } } intl.getLocale(); intl.loadTranslation('en'); function mountWithIntlTests() { intl.mountWithIntl(); const propsComponentWrapper = intl.mountWithIntl( , ); propsComponentWrapper.props().id; // $ExpectType number const stateComponentWrapper = intl.mountWithIntl<{}, State>( , ); stateComponentWrapper.state().constructed; // $ExpectType boolean } function renderWithIntlTests() { intl.renderWithIntl(); const wrapper = intl.renderWithIntl( , ); wrapper.toggleClass('toggle'); } function shallowWithIntlTests() { intl.shallowWithIntl(); const propsComponentWrapper = intl.shallowWithIntl( , ); propsComponentWrapper.props().id; // $ExpectType number const stateComponentWrapper = intl.shallowWithIntl<{}, State>( , ); stateComponentWrapper.state().constructed; // $ExpectType boolean } intl.setLocale('pl');