Skip to content

Commit ea1ded9

Browse files
committed
test: typescript
1 parent 3e64163 commit ea1ded9

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"types": "./index.d.ts",
77
"scripts": {
88
"build": "tsc src/index.ts --declaration --outDir .",
9-
"test": "jest --coverage"
9+
"test": "npm run -s test:code && npm run -s test:typescript",
10+
"test:code": "jest --coverage",
11+
"test:typescript": "npx tsc --noEmit --declaration --noUnusedLocals test-typescript.ts"
1012
},
1113
"repository": "github:gr2m/javascript-plugin-architecture-with-typescript-definitions",
1214
"keywords": [

test-typescript.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// ************************************************************
2+
// THIS CODE IS NOT EXECUTED. IT IS JUST FOR TYPECHECKING
3+
// ************************************************************
4+
5+
import { Base } from "./src";
6+
7+
function isString(what: string) {}
8+
9+
const base = new Base({ option: "value" });
10+
isString(base.options.option);
11+
12+
const BaseWithDefaults = Base.defaults({ parentOption: "value" });
13+
const baseWithDefaults = new BaseWithDefaults({ childOption: "value" });
14+
15+
isString(baseWithDefaults.options.childOption);
16+
isString(baseWithDefaults.options.parentOption);

0 commit comments

Comments
 (0)