Merge commit '759b400afea18079474947443a22e40d9b82a6cc'

This commit is contained in:
Jan Klimke
2017-04-25 17:58:39 +02:00
5 changed files with 76 additions and 1 deletions
+3 -1
View File
@@ -49,6 +49,8 @@ declare namespace i18n {
joinArrays?: string;
postProcess?: string | any[];
interpolation?: InterpolationOptions;
//add an indexer to assure that interpolation arguments can be passed
[x: string]: any;
}
interface Options {
@@ -106,7 +108,7 @@ declare namespace i18n {
t(key: string, options?: TranslationOptions): string | any | Array<any>;
exists(): boolean;
exists(key, options?: TranslationOptions): boolean;
setDefaultNamespace(ns: string): void;
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for qhistory 1.0
// Project: https://github.com/pshrmn/qhistory#readme
// Definitions by: Diogo Franco <https://github.com/Kovensky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export as namespace qhistory;
import { History } from 'history';
// augments the 'history' types when used
declare module 'history' {
interface Location {
// actually a complicated nested object/array system, but giving it a type
// makes _actually_ using it (or even casting to a known structure) much harder.
query: any;
}
interface LocationDescriptorObject {
query?: object;
}
}
declare function qhistory(
history: History,
stringify: (query: object) => string,
parse: (search: string) => object
): History;
export default qhistory;
+19
View File
@@ -0,0 +1,19 @@
import qhistory from 'qhistory';
import { createBrowserHistory } from 'history';
import * as qs from 'qs';
const history = qhistory(createBrowserHistory(), qs.stringify, qs.parse);
history.listen(location => {
const query: { foo?: string } = location.query;
if (query.foo) {
const foo: string = query.foo;
}
});
history.push({
pathname: '/',
query: {
foo: 'bar'
}
});
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"qhistory-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }