Skip to content

Commit 83b3344

Browse files
authored
Add Type Script declaration file
1 parent bdef8bc commit 83b3344

File tree

6 files changed

+1701
-2
lines changed

6 files changed

+1701
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ cloudinary.image("sample", {format: "png", width: 100, height: 100, crop: "fill"
202202
// <img src='http://res.cloudinary.com/demo/image/upload/c_fill,h_100,w_100/sample.png' height='100' width='100'/>
203203
```
204204

205+
### Typescript
206+
207+
🎉New 🎉TypeScript support was just added. Check out the [declaration file](https://github.com/cloudinary/cloudinary_npm/types/index.d.ts).
208+
205209
### Samples
206210

207211
You can find our simple and ready-to-use samples projects, along with documentation in the [samples folder](https://github.com/cloudinary/cloudinary_npm/tree/master/samples).

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"main": "cloudinary.js",
1313
"dependencies": {
1414
"lodash": "^4.17.11",
15-
"q": "^1.5.1"
15+
"q": "^1.5.1",
16+
"typescript": "^2.9.2"
1617
},
1718
"devDependencies": {
1819
"babel-cli": "^6.26.0",
@@ -24,6 +25,7 @@
2425
"babel-register": "^6.26.0",
2526
"babel-runtime": "^6.26.0",
2627
"dotenv": "4.x",
28+
"dtslint": "^0.9.1",
2729
"eslint": "^5.16.0",
2830
"eslint-config-airbnb-base": "^13.1.0",
2931
"eslint-plugin-import": "^2.17.2",
@@ -36,8 +38,18 @@
3638
"sinon": "^6.1.4",
3739
"webpack-cli": "^3.2.1"
3840
},
41+
"files": [
42+
"lib/**/*",
43+
"lib-es5/**/*",
44+
"cloudinary.js",
45+
"babel.config.js",
46+
"package.json",
47+
"types/*"
48+
],
49+
"types": "types",
3950
"scripts": {
40-
"test": "node_v=$(node --version)z\nif [[ \"${node_v%%.*z}\" == 'v4' ]]\nthen\nnpm run test-es5\nelse\necho 10 && npm run test-es6\nfi",
51+
"test": "node_v=$(node --version)z\nif [[ \"${node_v%%.*z}\" == 'v4' ]]\nthen\nnpm run test-es5\nelse\necho 10 && npm run test-es6\nfi\nnpm run dtslint",
52+
"dtslint": "dtslint --expectOnly --localTs node_modules/typescript/lib types ",
4153
"lint": "eslint .",
4254
"compile": "node_modules/.bin/babel lib --out-dir lib-es5 --delete-dir-on-start --verbose",
4355
"test-es6": "which node && node node_modules/.bin/mocha --ui bdd -R spec --recursive test/",

tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"noImplicitAny": true,
5+
"esModuleInterop": true,
6+
"allowSyntheticDefaultImports": true,
7+
"declaration": true
8+
},
9+
"include": [
10+
"dist/**/*",
11+
"types/**/*"
12+
],
13+
"exclude": [
14+
"node_modules"
15+
]
16+
}

0 commit comments

Comments
 (0)