Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turned on type script definitions #206

Merged
merged 2 commits into from
Sep 3, 2017
Merged

Conversation

dolanmiu
Copy link
Contributor

You guys are using Typescript already, so you just need to turn it on and allow it to be published

If this does not work, then I will think of other solutions :)

@chenguoguo
Copy link
Collaborator

Awesome! We will take a look!

@chenguoguo
Copy link
Collaborator

I'm trying this on my Mac and I got the following error, ideas?

npm ERR! Darwin 16.4.0
npm ERR! argv "/Users/guoguo/.nvm/versions/node/v4.0.0/bin/node" "/Users/guoguo/.nvm/versions/node/v4.0.0/bin/npm" "install"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.2
npm ERR! code ELIFECYCLE
npm ERR! snowboy@1.2.0 prepublish: `tsc --listFiles`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the snowboy@1.2.0 prepublish script 'tsc --listFiles'.
npm ERR! This is most likely a problem with the snowboy package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc --listFiles
npm ERR! You can get their info via:
npm ERR!     npm owner ls snowboy
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/guoguo/snowboy-release/npm-debug.log

@dolanmiu
Copy link
Contributor Author

dolanmiu commented Jun 1, 2017

Is there more logs? That log doesn't explain anything apart from:

tsc --listFiles is bad

@chenguoguo
Copy link
Collaborator

chenguoguo commented Jun 1, 2017

Here was the log before the error (I was simply doing npm install under the root directory):

> snowboy@1.2.0 preinstall /Users/guoguo/snowboy-release
> npm install node-pre-gyp

node-pre-gyp@0.6.36 node_modules/node-pre-gyp
├── semver@5.3.0
├── mkdirp@0.5.1 (minimist@0.0.8)
├── rc@1.2.1 (strip-json-comments@2.0.1, ini@1.3.4, deep-extend@0.4.2, minimist@1.2.0)
├── nopt@4.0.1 (abbrev@1.1.0, osenv@0.1.4)
├── rimraf@2.6.1 (glob@7.1.2)
├── tar-pack@3.4.0 (uid-number@0.0.6, once@1.4.0, debug@2.6.8, fstream@1.0.11, fstream-ignore@1.0.5, readable-stream@2.2.9)
├── npmlog@4.1.0 (set-blocking@2.0.0, console-control-strings@1.1.0, gauge@2.7.4, are-we-there-yet@1.1.4)
├── tar@2.2.1 (inherits@2.0.3, block-stream@0.0.9, fstream@1.0.11)
└── request@2.81.0 (is-typedarray@1.0.0, aws-sign2@0.6.0, oauth-sign@0.8.2, forever-agent@0.6.1, tunnel-agent@0.6.0, caseless@0.12.0, stringstream@0.0.5, isstream@0.1.2, json-stringify-safe@5.0.1, performance-now@0.2.0, safe-buffer@5.0.1, extend@3.0.1, aws4@1.6.0, uuid@3.0.1, combined-stream@1.0.5, qs@6.4.0, form-data@2.1.4, mime-types@2.1.15, tough-cookie@2.3.2, hawk@3.1.3, http-signature@1.1.1, har-validator@4.2.1)
npm WARN engine typescript@2.3.4: wanted: {"node":">=4.2.0"} (current: {"node":"4.0.0","npm":"2.14.2"})
\
> snowboy@1.2.0 install /Users/guoguo/snowboy-release
> node-pre-gyp install --fallback-to-build

[snowboy] Success: "/Users/guoguo/snowboy-release/lib/node/binding/Release/node-v46-darwin-x64/snowboy.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> snowboy@1.2.0 prepublish /Users/guoguo/snowboy-release
> tsc --listFiles

lib/node/index.ts(55,14): error TS4073: Parameter 'model' of public method from exported class has or is using private name 'HotwordModel'.
lib/node/index.ts(100,63): error TS4019: Implements clause of exported class 'SnowboyDetect' has or is using private name 'SnowboyDetectInterface'.
lib/node/index.ts(104,24): error TS4063: Parameter 'options' of constructor from exported class has or is using private name 'DetectorOptions'.
/Users/guoguo/snowboy-release/node_modules/typescript/lib/lib.es6.d.ts
/Users/guoguo/snowboy-release/lib/node/index.ts
/Users/guoguo/snowboy-release/lib/node/node-pre-gyp.d.ts
/Users/guoguo/snowboy-release/lib/node/SnowboyDetectNative.d.ts
/Users/guoguo/snowboy-release/node_modules/@types/node/index.d.ts

@dolanmiu
Copy link
Contributor Author

dolanmiu commented Jun 1, 2017

And there is no error on the master branch?

Damn, I have no idea then :(

@chenguoguo
Copy link
Collaborator

Correct, the master branch is able to build...

Were you able to reproduce the error on your side?

@dolanmiu
Copy link
Contributor Author

dolanmiu commented Jun 1, 2017

Ok, I am able to reproduce it, and found a solution here:

microsoft/TypeScript#6307

To fix, HotwordModel, SnowboyDetectInterface and DetectorOptions need to be exported

@Pajn
Copy link

Pajn commented Jul 16, 2017

Yeah, just add an export keyword for them. You need for TypeScript users to be able to import them otherwise the compiler have no possibility to know what the type names refer to.

@chenguoguo
Copy link
Collaborator

@dolanmiu is exporting it enough? if yes could you update this pull request?

@dolanmiu
Copy link
Contributor Author

dolanmiu commented Aug 29, 2017

I have not updated it to export yet, I can do that in a sec

@dolanmiu
Copy link
Contributor Author

dolanmiu commented Aug 29, 2017

Done, can you check?

I ran npm run prepublish, and it gave no errors

@chenguoguo
Copy link
Collaborator

Merging it, thanks!

@chenguoguo chenguoguo merged commit e3456da into Kitt-AI:master Sep 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants