Skip to content

Commit

Permalink
feat: add typescript declaration file for ImgixClient (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
sherwinski authored Oct 22, 2019
1 parent 8afc19d commit a065ad9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
"repository": "https://github.com/imgix/imgix-core-js",
"scripts": {
"assert_version": "node assert_version.js",
"compile": "mkdir -p dist && uglifyjs ./src/imgix-core-js.js -o ./dist/imgix-core-js.min.js && cp ./src/imgix-core-js.js ./dist/imgix-core-js.js",
"compile": "mkdir -p dist && uglifyjs ./src/imgix-core-js.js -o ./dist/imgix-core-js.min.js && cp ./src/imgix-core-js.js ./dist/imgix-core-js.js && cp ./src/imgix-core-js.d.ts ./dist/imgix-core-js.d.ts && tsc",
"prepublish": "npm run compile && npm run assert_version",
"test": "mocha"
},
"main": "dist/imgix-core-js.js",
"types": "dist/imgix-core-js.d.ts",
"dependencies": {
"js-base64": "^2.1.9",
"md5": "^2.2.1"
"md5": "^2.2.1",
"typescript": "^3.6.3",
"@types/node": "^12.7.8"
},
"license": "BSD-2-Clause",
"devDependencies": {
Expand Down
20 changes: 20 additions & 0 deletions src/imgix-core-js.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Type definitions for imgix-core-js.js

declare class ImgixClient {
domain: string;
useHTTPS: boolean;
includeLibraryParam: boolean;
secureURLToken: string;

constructor(opts: {domain: string; secureURLToken?: string; useHTTPS?: boolean; includeLibraryParam?: boolean;});


buildURL(path: string, params?: {}): string;
_sanitizePath(path: string): string;
_buildParams(params: {}): string;
_signParams(path: string, queryParams?: {}): string;
buildSrcSet(path: string, params?: {}): string;
_buildSrcSetPairs(path: string, params?: {}): string;
_buildDPRSrcSet(path: string, params?: {}): string;
}
export = ImgixClient;
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "es2015",
"module": "umd",
"types": [
"node"
]
},
"files": [
"src/imgix-core-js.d.ts"
]
}

0 comments on commit a065ad9

Please sign in to comment.