nodejs-compute icon indicating copy to clipboard operation
nodejs-compute copied to clipboard

Missing typescript declaration file

Open garyo opened this issue 5 years ago • 5 comments

Environment details

  • OS: Linux
  • npm version: latest
  • @google-cloud/compute version: 2.1.0

Steps to reproduce

  1. Install it with npm/yarn
  2. Try to use it from typescript with import Compute from '@google-cloud/compute
  3. See errors re: missing typescript declaration

It seems this lib is missing a .d.ts typescript decl file, and I was unable to find typings on definitely-typed either. If this is intended to be the idiomatic way to interact with the compute API, I think typings would be very helpful.

garyo avatar Sep 19 '20 17:09 garyo

Saw this issue and thought, well, how hard can it be to re-write the library in TS? And then I saw the thousands of lines of code in some of the files, and now I see where it might be an issue. I would like to help with this issue, if I can, and am willing to migrate the library to TS if that is inline with the library's roadmap. If I were to start doing this, is there anything I should know beforehand? Or should I just look at other google-cloud libraries and follow their lead?

roikoren755 avatar Dec 10 '20 15:12 roikoren755

I opened a PR migrating this library to TS (#534). There are still a few things that need to be fixed, I would gladly continue conversation on this issue there/here.

roikoren755 avatar Jan 04 '21 20:01 roikoren755

the library is now fully TS, but i think the api changed. the npm version still isn't typescript, i added the dependency directly from this repo (yarn add https://github.com/googleapis/nodejs-compute, not sure if it's the same with npm)

ghost avatar Sep 10 '21 15:09 ghost

This looks great -- is there a list of new features anywhere? For instance, does it support ADC? I see it does now support promises and async/await, a big advance. I don't see any typescript examples though.

Is this now good enough to replace https://github.com/googleapis/google-api-nodejs-client (i.e. import {google} from googleapis) for use with typescript? (CCing @JustinBeckwith per issue https://github.com/googleapis/google-cloud-node/issues/952 )

garyo avatar Sep 10 '21 16:09 garyo

Hi everyone, I had the same problem.

The reason why this package does not include a typescript declaration file:

  • Current "latest" version on npm is 2.6.0 which is an old version without typescript declaration file
  • This repository is version 3.0.0 which is newer with typescript declaration file. And this newer version has been published to npm but unfortunately the "latest" tag still points to the old version.

For this moment, I use this solution to fix it:

npm install --save @google-cloud/[email protected]

However it seems some APIs have changed. Maybe we should use this newer version later?

Jianru-Lin avatar Sep 19 '21 07:09 Jianru-Lin

Hello! We are migrating this repo over to google-cloud-node. If this is still a concern for you, we ask you kindly reopen the issue there. Thank you very much!

sofisl avatar Nov 16 '22 17:11 sofisl