Skip to content

Commit c5c4cff

Browse files
committed
[feat] Add script to generate bcoin types
Unfortunately this is useless right now because typescript does not generate the types correctly yet. We have to wait for typescript >= 4.0 See microsoft/TypeScript#37832
1 parent ac53774 commit c5c4cff

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,5 @@ dist
116116
.pnp.*
117117

118118
build/
119-
coverage/
119+
coverage/
120+
src/srv/bcoin/types/

src/srv/bcoin/gettypes.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
bcoin_dir=$(dirname $(realpath $0))
4+
bcoin_git_clone="$bcoin_dir/tmp_clone"
5+
6+
7+
echo $bcoin_git_clone
8+
9+
git clone https://github.com/bcoin-org/bcoin.git $bcoin_git_clone
10+
11+
cd $bcoin_git_clone
12+
npm install typescript
13+
14+
$bcoin_git_clone/node_modules/.bin/tsc --allowJs -d --outDir ./types --emitDeclarationOnly ./lib/**/*.js || true
15+
16+
cp -r $bcoin_git_clone/types $bcoin_dir/
17+
18+
rm -rf $bcoin_git_clone
19+
20+
echo "\e[42m\e[30mYou can ignore TS9006 errors above, that issue won't be resolved until typescript4.0\e[0m"
21+
echo "See here: https://github.com/microsoft/TypeScript/issues/37832"

0 commit comments

Comments
 (0)