Fixes to the typings so that they are used better

This commit is contained in:
Bryan Johnson
2016-09-21 14:28:41 -06:00
parent 58992a5a55
commit 34aa4d39ee

View File

@@ -1,5 +1,5 @@
// Type definitions for i18next-xhr-backend 1.2.0
// Project: http://i18next.com/
// Project: https://github.com/i18next/i18next-xhr-backend
// Definitions by: Jan Mühlemann <https://github.com/jamuhl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -12,23 +12,25 @@ declare module 'i18next-xhr-backend' {
interpolator: Interpolator
}
interface BackendOptions {
loadPath: string | Function,
addPath: string,
allowMultiLoading: boolean,
parse: Function,
crossDomain: boolean,
withCredentials: boolean,
ajax: Function
}
export default class Backend {
type: 'backend';
services: Services;
options: {
loadPath: string | Function,
addPath: string,
allowMultiLoading: boolean,
parse: () => {},
crossDomain: boolean,
withCredentials: boolean,
ajax: () => void
};
constructor(services: Services, options?: {});
init(services: Services, options?: {}): void;
readMulti(languages: any[], namespaces: any[], callback: () => void): void;
read(language: {}, namespace: {}, callback: () => void): void;
loadUrl(url: string, callback: () => void): void;
options: BackendOptions;
constructor(services: Services, options?: BackendOptions);
init(services: Services, options?: BackendOptions): void;
readMulti(languages: any[], namespaces: any[], callback: Function): void;
read(language: {}, namespace: {}, callback: Function): void;
loadUrl(url: string, callback: Function): void;
create(languages: any[], namespace: string, key: string, fallbackValue: string): void;
}
}