Skip to content

Commit

Permalink
Fix #110 Type Definition Error (#111)
Browse files Browse the repository at this point in the history
* Add test to reproduce the issue

* And fix the issue.

* Prepare release
  • Loading branch information
jwagner authored Sep 1, 2021
1 parent 1f40486 commit 027c207
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ In other words, it's fine to run it on one image, it's suboptimal to run it on a

## Version history

### 2.0.5
Fix `TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.`.

### 2.0.4
Typescript type definitions.

Expand Down
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface CropOptions {
ruleOfThirds?: boolean;
debug?: boolean;
}
const smartcrop: {
declare const smartcrop: {
crop(image: CanvasImageSource, options: CropOptions): Promise<CropResult>;
};
export default smartcrop;
export default smartcrop;
35 changes: 26 additions & 9 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "smartcrop",
"version": "2.0.4",
"version": "2.0.5",
"description": "Content aware image cropping.",
"homepage": "https://github.com/jwagner/smartcrop.js",
"author": "Jonas Wagner <[email protected]> (http://29a.ch/)",
Expand All @@ -10,6 +10,7 @@
"index.d.ts"
],
"devDependencies": {
"@types/webgl2": "^0.0.6",
"benchmark": "^2.1.4",
"chai": "^4.2.0",
"eslint": "^7.30.0",
Expand All @@ -35,7 +36,7 @@
},
"scripts": {
"start": "grunt",
"test": "karma start karma.conf.js",
"test": "karma start karma.conf.js && npx tsc -noEmit test/types.ts",
"lint": "eslint smartcrop.js test examples/slideshow.js examples/testbed.js examples/testsuite.js examples/smartcrop-debug.js"
}
}
3 changes: 3 additions & 0 deletions test/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import SmartCrop from '..';

console.log(SmartCrop.crop);

0 comments on commit 027c207

Please sign in to comment.