From 33e0c2dcefa36b3505d2af9411324a9c649a412a Mon Sep 17 00:00:00 2001 From: Jan Mazak Date: Sat, 10 Dec 2022 11:35:30 +0100 Subject: [PATCH] fix: flow types --- package.json | 7 ++++--- src/Ada.ts | 5 ++++- tsconfig.base.json | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 06546810..48b3ca66 100644 --- a/package.json +++ b/package.json @@ -65,11 +65,12 @@ }, "homepage": "https://github.com/cardano-foundation/ledgerjs-hw-app-cardano", "scripts": { - "prepack": "yarn build:flowtypes && yarn flow", + "prepack": "yarn build:flowtypes && yarn flow && yarn build", "lint": "yarn eslint . --max-warnings=0", "clean": "rm -rf dist/", - "build": "yarn tsc -p src/tsconfig.json", - "build:flowtypes": "find . -type f -not -path './node_modules/*' -not -path './example-node/*' -name '*.d.ts' -exec sh -c 'yarn flowgen --add-flow-header --no-inexact $1 -o ${1%.*.*}.js.flow' _ '{}' \\;", + "build": "yarn tsc -p src/tsconfig.json --removeComments", + "build-with-comments": "yarn tsc -p src/tsconfig.json", + "build:flowtypes": "yarn build-with-comments && find . -type f -not -path './node_modules/*' -not -path './example-node/*' -name '*.d.ts' -exec sh -c 'yarn flowgen --add-flow-header --no-inexact $1 -o ${1%.*.*}.js.flow' _ '{}' \\;", "flow": "flow --show-all-errors dist/", "gen-docs": "yarn typedoc", "prepublish": "yarn run clean && yarn run build", diff --git a/src/Ada.ts b/src/Ada.ts index 705946f6..faf84428 100644 --- a/src/Ada.ts +++ b/src/Ada.ts @@ -128,11 +128,14 @@ async function interact( * @category Main */ export class Ada { - /** @ignore */ + // we generate flow type annotations for the package + // and it does not work for Transport, so we suppress the error + /** $FlowIgnore[value-as-type] */ transport: Transport; /** @ignore */ _send: SendFn; + /** $FlowIgnore[value-as-type] */ constructor(transport: Transport, scrambleKey: string = "ADA") { this.transport = transport // Note: this is list of methods that should "lock" the transport to avoid concurrent use diff --git a/tsconfig.base.json b/tsconfig.base.json index c072e7d9..41233cab 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -15,7 +15,7 @@ "noUnusedLocals": false, "outDir": "dist", "pretty": true, - "removeComments": true, + "removeComments": false, "resolveJsonModule": true, "skipLibCheck": true, "strict": true,