Skip to content

Commit

Permalink
add types test
Browse files Browse the repository at this point in the history
  • Loading branch information
Riku committed Nov 9, 2018
1 parent aa06166 commit ff9483b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"test": "nyc --reporter=html mocha"
"test": "nyc --reporter=html mocha && ts-node test/tsd.ts"
},
"repository": {
"type": "git",
Expand All @@ -24,7 +24,10 @@
},
"homepage": "https://github.com/invertase/a2a#readme",
"devDependencies": {
"@types/node": "^10.12.4",
"mocha": "^5.2.0",
"nyc": "^13.0.1"
"nyc": "^13.0.1",
"ts-node": "^7.0.1",
"typescript": "^3.1.6"
}
}
11 changes: 11 additions & 0 deletions test/tsd.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import a2a from '../';

a2a(Promise.resolve(1))
.then(([err, result]) => {
console.log(result as number);
});

a2a([Promise.resolve(1)])
.then(([err, result]) => {
console.log(result as number[]);
});
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"lib": ["es2015"],
"strict": true,
"moduleResolution": "node",
"types": ["node"],
"esModuleInterop": true
},
"include": ["index.d.ts", "test/*.ts"]
}

0 comments on commit ff9483b

Please sign in to comment.