fix: add def checks and fix typescript def

This commit is contained in:
Justin Starry
2020-03-03 11:16:19 +08:00
committed by Michael Vines
parent eb1542696e
commit 01e65d2070
6 changed files with 33 additions and 10 deletions

View File

@ -3,8 +3,6 @@
<PROJECT_ROOT>/lib/.* <PROJECT_ROOT>/lib/.*
<PROJECT_ROOT>/internals/.* <PROJECT_ROOT>/internals/.*
[include]
[options] [options]
emoji=true emoji=true

View File

@ -37,6 +37,7 @@ script:
- test -r lib/index.cjs.js - test -r lib/index.cjs.js
- test -r lib/index.esm.js - test -r lib/index.esm.js
- npm run doc - npm run doc
- npm run defs
- npm run flow - npm run flow
- npm run lint - npm run lint
- npm run codecov - npm run codecov

9
web3.js/module.d.ts vendored
View File

@ -1,4 +1,5 @@
declare module '@solana/web3.js' { declare module '@solana/web3.js' {
import {Buffer} from 'buffer';
import * as BufferLayout from 'buffer-layout'; import * as BufferLayout from 'buffer-layout';
// === src/publickey.js === // === src/publickey.js ===
@ -425,7 +426,7 @@ declare module '@solana/web3.js' {
| 'Deactivate'; | 'Deactivate';
export const STAKE_INSTRUCTION_LAYOUTS: { export const STAKE_INSTRUCTION_LAYOUTS: {
[StakeInstructionType]: InstructionType; [type in StakeInstructionType]: InstructionType;
}; };
export class StakeInstruction extends TransactionInstruction { export class StakeInstruction extends TransactionInstruction {
@ -434,7 +435,7 @@ declare module '@solana/web3.js' {
authorizedPublicKey: PublicKey | null; authorizedPublicKey: PublicKey | null;
constructor( constructor(
opts?: TransactionInstructionCtorFields, opts: TransactionInstructionCtorFields,
type: StakeInstructionType, type: StakeInstructionType,
); );
static from(instruction: TransactionInstruction): StakeInstruction; static from(instruction: TransactionInstruction): StakeInstruction;
@ -501,7 +502,7 @@ declare module '@solana/web3.js' {
| 'AuthorizeNonceAccount'; | 'AuthorizeNonceAccount';
export const SYSTEM_INSTRUCTION_LAYOUTS: { export const SYSTEM_INSTRUCTION_LAYOUTS: {
[SystemInstructionType]: InstructionType; [type in SystemInstructionType]: InstructionType;
}; };
export class SystemInstruction extends TransactionInstruction { export class SystemInstruction extends TransactionInstruction {
@ -511,7 +512,7 @@ declare module '@solana/web3.js' {
amount: number | null; amount: number | null;
constructor( constructor(
opts?: TransactionInstructionCtorFields, opts: TransactionInstructionCtorFields,
type: SystemInstructionType, type: SystemInstructionType,
); );
static from(instruction: TransactionInstruction): SystemInstruction; static from(instruction: TransactionInstruction): SystemInstruction;

View File

@ -10,6 +10,7 @@
* *
*/ */
import {Buffer} from 'buffer';
import * as BufferLayout from 'buffer-layout'; import * as BufferLayout from 'buffer-layout';
declare module '@solana/web3.js' { declare module '@solana/web3.js' {

View File

@ -6871,6 +6871,11 @@
"safe-buffer": "^5.0.1" "safe-buffer": "^5.0.1"
} }
}, },
"base64-js": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
},
"bcrypt-pbkdf": { "bcrypt-pbkdf": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
@ -7167,6 +7172,15 @@
"integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=", "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=",
"dev": true "dev": true
}, },
"buffer": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz",
"integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4"
}
},
"buffer-es6": { "buffer-es6": {
"version": "4.9.3", "version": "4.9.3",
"resolved": "https://registry.npmjs.org/buffer-es6/-/buffer-es6-4.9.3.tgz", "resolved": "https://registry.npmjs.org/buffer-es6/-/buffer-es6-4.9.3.tgz",
@ -11255,6 +11269,11 @@
"integrity": "sha512-zfNREywMuf0NzDo9mVsL0yegjsirJxHpKHvWcyRozIqQy89g0a3U+oBPOCN4cc0oCiOuYgZHimzaW/R46G1Mpg==", "integrity": "sha512-zfNREywMuf0NzDo9mVsL0yegjsirJxHpKHvWcyRozIqQy89g0a3U+oBPOCN4cc0oCiOuYgZHimzaW/R46G1Mpg==",
"dev": true "dev": true
}, },
"ieee754": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
},
"ignore": { "ignore": {
"version": "4.0.6", "version": "4.0.6",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz",
@ -22715,9 +22734,9 @@
"dev": true "dev": true
}, },
"typescript": { "typescript": {
"version": "3.7.5", "version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true "dev": true
}, },
"typescript-compiler": { "typescript-compiler": {

View File

@ -45,6 +45,7 @@
"codecov": "set -ex; npm run test:cover; cat ./coverage/lcov.info | codecov", "codecov": "set -ex; npm run test:cover; cat ./coverage/lcov.info | codecov",
"dev": "cross-env NODE_ENV=development rollup -c", "dev": "cross-env NODE_ENV=development rollup -c",
"doc": "set -ex; esdoc; node -p '\"\\nDocumentation coverage: \" + require(\"./doc/coverage.json\").coverage'", "doc": "set -ex; esdoc; node -p '\"\\nDocumentation coverage: \" + require(\"./doc/coverage.json\").coverage'",
"defs": "set -ex; flow check-contents < module.flow.js; tsc module.d.ts",
"doc:watch": "watch 'npm run doc' . --wait=1 --ignoreDirectoryPattern=/doc/", "doc:watch": "watch 'npm run doc' . --wait=1 --ignoreDirectoryPattern=/doc/",
"examples": "set -ex; for example in examples/*.js; do node $example; done", "examples": "set -ex; for example in examples/*.js; do node $example; done",
"flow": "set -ex; flow stop; flow-typed install jest@24; flow", "flow": "set -ex; flow stop; flow-typed install jest@24; flow",
@ -57,7 +58,7 @@
"localnet:logs": "bin/localnet.sh logs -f", "localnet:logs": "bin/localnet.sh logs -f",
"localnet:up": "bin/localnet.sh up", "localnet:up": "bin/localnet.sh up",
"localnet:update": "bin/localnet.sh update", "localnet:update": "bin/localnet.sh update",
"ok": "run-s lint flow test doc", "ok": "run-s lint flow test doc defs",
"prepare": "run-s clean bpf-sdk:install bpf-sdk:remove-symlinks build", "prepare": "run-s clean bpf-sdk:install bpf-sdk:remove-symlinks build",
"pretty": "prettier --write '{,{examples,src,test}/**/}*.{j,t}s'", "pretty": "prettier --write '{,{examples,src,test}/**/}*.{j,t}s'",
"re": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git", "re": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git",
@ -70,6 +71,7 @@
"@babel/runtime": "^7.3.1", "@babel/runtime": "^7.3.1",
"bn.js": "^5.0.0", "bn.js": "^5.0.0",
"bs58": "^4.0.1", "bs58": "^4.0.1",
"buffer": "^5.4.3",
"buffer-layout": "^1.2.0", "buffer-layout": "^1.2.0",
"esdoc-inject-style-plugin": "^1.0.0", "esdoc-inject-style-plugin": "^1.0.0",
"hasha": "^5.1.0", "hasha": "^5.1.0",
@ -129,6 +131,7 @@
"rollup-plugin-replace": "2.2.0", "rollup-plugin-replace": "2.2.0",
"rollup-plugin-terser": "^5.0.0", "rollup-plugin-terser": "^5.0.0",
"semantic-release": "^17.0.2", "semantic-release": "^17.0.2",
"typescript": "^3.8.3",
"watch": "^1.0.2" "watch": "^1.0.2"
} }
} }