Skip to content

Commit ec243e5

Browse files
committed
exporting type definations with tsc and buffer issue fix
1 parent eece0fd commit ec243e5

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
},
4040
"scripts": {
4141
"dev": "rollup -c -w",
42-
"build": "rm -rf dist*;rollup -c",
42+
"export-types" : "tsc",
43+
"build": "rm -rf dist*;rollup -c && yarn export-types",
4344
"test": "NODE_ENV=test nyc ./node_modules/mocha/bin/mocha test/*.js",
4445
"startSampleApp": "yarn build && cd samples/sample-app/ && yarn install && node index.js",
4546
"report-coverage": "codecov"

src/interfaces/UploadOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface UploadOptions {
1212
* Downloading file from URL might take longer, so it is recommended that you pass the binary or base64 content of the file.
1313
* Pass the full URL, for example - https://www.example.com/rest-of-the-image-path.jpg.
1414
*/
15-
file: string | Buffer | File;
15+
file: string | Blob | File;
1616
/**
1717
* The name with which the file has to be uploaded.
1818
* The file name can contain:

src/interfaces/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ import { UploadOptions } from "./UploadOptions";
44
import { UploadResponse, FileType } from "./UploadResponse";
55
import { UrlOptions } from "./UrlOptions";
66

7-
export { ImageKitOptions, TransformationPosition, UploadOptions, UploadResponse, FileType, UrlOptions };
7+
export type { ImageKitOptions, TransformationPosition, UploadOptions, UploadResponse, FileType, UrlOptions };

src/upload/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ export const upload = (
4040
if (typeof param !== "undefined") {
4141
if (typeof param === "string" || typeof param === "boolean") {
4242
formData.append(i, String(param));
43-
} else if (param instanceof Buffer) {
44-
formData.append(i, new Blob([param]), uploadOptions.fileName);
4543
} else {
4644
formData.append(i, param);
4745
}

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
1515
// "sourceMap": true, /* Generates corresponding '.map' file. */
1616
// "outFile": "./", /* Concatenate and emit output to single file. */
17-
// "outDir": "./out-tsc", /* Redirect output structure to the directory. */
17+
"outDir": "./dist", /* Redirect output structure to the directory. */
1818
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
1919
// "composite": true, /* Enable project compilation */
2020
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
@@ -67,7 +67,8 @@
6767
/* Advanced Options */
6868
"skipLibCheck": true, /* Skip type checking of declaration files. */
6969
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
70-
"resolveJsonModule": true
70+
"resolveJsonModule": true,
71+
"emitDeclarationOnly" : true
7172
},
7273
"include": ["src/**/*"],
7374
"exclude": ["node_modules"]

0 commit comments

Comments
 (0)