Skip to content

Commit

Permalink
Typings (#22)
Browse files Browse the repository at this point in the history
* typings

* tsconfig
  • Loading branch information
cancerberoSgx authored and KnicKnic committed Oct 24, 2018
1 parent cbd600d commit ccecb8b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"version": "1.1.1",
"description": "Webassembly compilation of ImageMagick",
"main": "dist/magickApi.js",
"typings": "typings.d.ts",
"scripts": {
"test": "(cd tests/rotate && node node)",
"build-wasm": "docker build -t wasm-imagemagick-build-tools . && docker run --rm --workdir /code -v \"$PWD\":/code wasm-imagemagick-build-tools bash ./build.sh",
"build-ts": "tsc --skipLibCheck --allowJs magickApi.js --outDir dist",
"build-ts": "tsc",
"build": "npm run build-wasm && npm run build-ts",
"prepare": "npm run build && cp magick.js magick.wasm dist",
"clean":"sh clean.sh"
Expand Down
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"allowJs": true,
"lib": [
"dom", "es6"
],
"skipLibCheck": true
},
"include": [
"magickApi.js"
],
"exclude": [
"node_modules", "dist"
]
}

14 changes: 14 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface MagickFile {
name: string
}

export interface MagickOutputFile extends MagickFile {
blob: Blob
}

export interface MagickInputFile extends MagickFile {
/** content of the input file. This is declared as optional so higher level APIs can extend this interface but it must be initialized in order to execute convert */
content?: Uint8Array
}

export declare function Call(files: MagickInputFile[], command: string[]): Promise<MagickOutputFile[]>

0 comments on commit ccecb8b

Please sign in to comment.