Made react-i18next typings compatible with strictNullChecks

This commit is contained in:
Kostya Esmukov 2016-10-23 09:02:45 +03:00
parent 47feec0e12
commit 79eec0c2f3
No known key found for this signature in database
GPG Key ID: 2D3B9C1712FF84F7
3 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,7 @@ interface InterpolateProps {
useDangerouslySetInnerHTML?: boolean;
dangerouslySetInnerHTMLPartElement?: string;
[regexKey: string]: InterpolateValue | RegExp | I18next.TranslationOptions | boolean;
[regexKey: string]: InterpolateValue | RegExp | I18next.TranslationOptions | boolean | undefined;
}
export class Interpolate extends React.Component<InterpolateProps, {}> { }

View File

@ -26,7 +26,7 @@ interface InnerAnotherComponentProps {
class InnerAnotherComponent extends React.Component<InnerAnotherComponentProps, {}> {
render() {
const { _ } = this.props;
const _ = this.props._!;
return <p>{_('content.text', { /* options t options */ })}</p>;
}
@ -41,7 +41,7 @@ interface InnerYetAnotherComponentProps extends InjectedTranslateProps {
class InnerYetAnotherComponent extends React.Component<InnerYetAnotherComponentProps, {}> {
render() {
const { t } = this.props;
const t = this.props.t!;
return <p>{t('usingDefaultNS', { /* options t options */ })}</p>;
}
@ -55,7 +55,7 @@ interface TranslatableViewProps extends InjectedTranslateProps {
@translate(['view', 'nav'], { wait: true })
class TranslatableView extends React.Component<TranslatableViewProps, {}> {
render() {
const { t } = this.props;
const t = this.props.t!;
let interpolateComponent = <strong>"a interpolated component"</strong>;

View File

@ -3,7 +3,7 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"