Skip to content

Commit e1f2769

Browse files
Fixed ts typings (#14)
1 parent 101c7e7 commit e1f2769

File tree

193 files changed

+2346
-717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+2346
-717
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ jobs:
4343
- name: Run tests
4444
run: |
4545
npm i
46-
npm run formatCheck
46+
rm -r ./types
4747
npx tsc
48-
npx quick-lint-js ./**/*.mjs ./**/*.ts
48+
npx tsc -p ./test
49+
# ensure that committed and generated types are the same
50+
git diff --exit-code
51+
npx quick-lint-js ./**/*.mjs
52+
npm run formatCheck
4953
NODE_V8_COVERAGE=coverage0 npx c8 -r lcovonly --all --src ./src node --experimental-test-coverage ./test/all.mjs
5054
if: ${{ env.TAG_NAME == '' }}
5155

index.d.ts renamed to index.d.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { DetailedBlessedProps } from "react-blessed";
33
import Blessed from "@farjs/blessed";
44

55
type ButtonElement = Blessed.Widgets.ButtonElement;
6-
type FormElement = Blessed.Widgets.FormElement;
6+
type FormElement = Blessed.Widgets.FormElement<any>;
77
type TextElement = Blessed.Widgets.TextElement;
88

99
declare module "react" {

package.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
"license": "MIT",
66
"description": "Terminal UI React.js components library",
77
"scripts": {
8-
"lint": "quick-lint-js ./**/*.mjs ./**/*.ts",
9-
"test": "tsc && bun test && node ./test/all.mjs",
10-
"format": "prettier **/*.mjs **/*.ts --write",
11-
"formatCheck": "prettier **/*.mjs **/*.ts --check"
8+
"lint": "quick-lint-js ./**/*.mjs",
9+
"test": "tsc && tsc -p ./test && bun test && node ./test/all.mjs",
10+
"format": "prettier **/*.mjs --write",
11+
"formatCheck": "prettier **/*.mjs --check"
1212
},
1313
"type": "module",
1414
"exports": {
15-
"./*": "./src/*"
15+
"./*": {
16+
"types": "./types/*",
17+
"default": "./src/*"
18+
}
1619
},
20+
"types": "./types/*",
1721
"private": false,
1822
"publishConfig": {
1923
"access": "public"
@@ -47,10 +51,10 @@
4751
"@types/react-blessed": "^0.7.3",
4852
"@types/react-test-renderer": "^17.0.1",
4953
"c8": "^7.13.0",
50-
"mock-fn": "^1.0.0",
54+
"mock-fn": "^1.1.0",
5155
"prettier": "^2.8.8",
5256
"quick-lint-js": "^3.0.0",
53-
"react-assert": "^1.0.3",
57+
"react-assert": "^1.1.0",
5458
"react-test-renderer": "^17.0.1",
5559
"typescript": "^4.9.5"
5660
}

src/Button.d.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Button.mjs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
/**
2-
* @typedef {import("./Button").ButtonProps} ButtonProps
3-
*/
41
import React, { useState } from "react";
52
import * as UI from "./UI.mjs";
63

74
const h = React.createElement;
85

6+
/**
7+
* @typedef {{
8+
* readonly left: number;
9+
* readonly top: number;
10+
* readonly label: string;
11+
* readonly style: import("@farjs/blessed").Widgets.Types.TStyle;
12+
* onPress(): void;
13+
* }} ButtonProps
14+
*/
15+
916
/**
1017
* @param {ButtonProps} props
1118
*/

src/ButtonsPanel.d.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/ButtonsPanel.mjs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
/**
2-
* @typedef {import("./ButtonsPanel").ButtonsPanelProps} ButtonsPanelProps
3-
*/
41
import React from "react";
52
import Button from "./Button.mjs";
63

74
const h = React.createElement;
85

6+
/**
7+
* @typedef {{
8+
* readonly label: string;
9+
* onAction(): void;
10+
* }} ButtonsPanelAction
11+
*/
12+
13+
/**
14+
* @typedef {{
15+
* readonly top: number;
16+
* readonly actions: ButtonsPanelAction[];
17+
* readonly style: import("@farjs/blessed").Widgets.Types.TStyle;
18+
* readonly padding?: number;
19+
* readonly margin?: number;
20+
* }} ButtonsPanelProps
21+
*/
22+
923
/**
1024
* @param {ButtonsPanelProps} props
1125
*/

src/CheckBox.d.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/CheckBox.mjs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
/**
2-
* @typedef {import("./CheckBox").CheckBoxProps} CheckBoxProps
3-
*/
41
import React from "react";
52
import Button from "./Button.mjs";
63

74
const h = React.createElement;
85

6+
/**
7+
* @typedef {{
8+
* readonly left: number;
9+
* readonly top: number;
10+
* readonly value: boolean;
11+
* readonly label: string;
12+
* readonly style: import("@farjs/blessed").Widgets.Types.TStyle;
13+
* onChange(): void;
14+
* }} CheckBoxProps
15+
*/
16+
917
/**
1018
* @param {CheckBoxProps} props
1119
*/

src/ComboBox.d.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)