From ee442250c96861d23fc000477c319cb9ff7ac782 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Fri, 10 Jan 2020 21:01:25 +0000 Subject: [PATCH] Reconfigure TypeScript compiler --- .gitignore | 4 +++- package.json | 9 ++++----- test/index.ts | 4 ++-- tsconfig.json | 3 ++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 6e22af35..7f67447f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ node_modules package-lock.json # TypeScript -/build \ No newline at end of file +/build +**/*.d.ts +**/*.js diff --git a/package.json b/package.json index 56101d52..c21dad47 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "description": "A few useful functions for signing ethereum data", "main": "index.js", "scripts": { - "build": "tsc -d", - "test": "npm run build && ts-node test/index.ts" + "build": "tsc --project .", + "test": "npm run build && node test/index.js" }, "repository": { "type": "git", @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/MetaMask/eth-sig-util#readme", "dependencies": { - "@types/node": "^13.1.2", + "@types/node": "^10", "buffer": "^5.2.1", "elliptic": "^6.4.0", "ethereumjs-abi": "0.6.5", @@ -32,7 +32,6 @@ }, "devDependencies": { "tape": "^4.9.1", - "ts-node": "^8.5.4", - "typescript": "3.4.3" + "typescript": "3.7.4" } } diff --git a/test/index.ts b/test/index.ts index a3f2eadc..3cb1adda 100644 --- a/test/index.ts +++ b/test/index.ts @@ -509,7 +509,7 @@ test('signedTypeData with V3 string', (t) => { { name: 'contents', type: 'string' } ], }, - primaryType: 'Mail' as 'Mail', + primaryType: 'Mail' as const, domain: { name: 'Ether Mail', version: '1', @@ -581,7 +581,7 @@ test('signedTypeData_v4', (t) => { chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, - primaryType: 'Mail' as 'Mail', + primaryType: 'Mail' as const, message: { from: { name: 'Cow', diff --git a/tsconfig.json b/tsconfig.json index 96e423f2..d86fb8da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,10 @@ { "compilerOptions": { - "outDir": "./build", + "declaration": true, "target": "es5" }, "include": [ + "./test/**/*", "./index.ts", "./utils/**/*" ]