mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge commit '759b400afea18079474947443a22e40d9b82a6cc'
This commit is contained in:
Vendored
+3
-1
@@ -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;
|
||||
|
||||
|
||||
Vendored
+30
@@ -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;
|
||||
@@ -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'
|
||||
}
|
||||
});
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user