Skip to content

Commit

Permalink
chore: add a typing declaration file
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeAmat committed Aug 13, 2018
1 parent 32f301e commit cfe3e19
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
43 changes: 43 additions & 0 deletions index.d.ts
@@ -0,0 +1,43 @@
declare module 'osmose-request' {

export interface Item {
id: number;
name: string;
tags: string[];
count: number[] | null;
levels: number[];
}

export interface Category {
id: number;
name: string;
items: Item[];
}

export interface Error {
[key: string]: string;
}

export interface Options {
language?: string;
endpoint?: string;
}

export default class OsmoseRequest {
constructor(options?: Options);

closeError(errorId: number | string): Promise<boolean>;

falseError(errorId: number | string): Promise<boolean>;

fetchError(errorId: number | string): Promise<Error>;

fetchErrors(params: {}): Promise<Error[]>;

fetchItemCategories(): Promise<Category[]>;

fetchItems(isoCountryCode?: string): Promise<Item[]>;

fetchSupportedCountries(): string[];
}
}
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -17,8 +17,10 @@
"api"
],
"main": "dist/OsmoseRequest.js",
"types": "index.d.ts",
"files": [
"dist"
"dist",
"index.d.ts"
],
"scripts": {
"watch": "webpack -w --progress",
Expand Down

0 comments on commit cfe3e19

Please sign in to comment.