Google-api-nodejs-client: Typescript definition file

Created on 13 Jan 2016  路  22Comments  路  Source: googleapis/google-api-nodejs-client

Could you include the d.ts file in this client distribution?

feature request

Most helpful comment

I'm starting to work on this one. This has to be done over several PRs, but the plan is:

  • [x] Perform a basic update the files to *.ts and wire up the compiler (#731)
  • [x] Introduce arrow functions, const, let, and other basics (#732)
  • [x] Fix syntax to move towards classes and es6 style imports
  • [ ] Introduce tslint with relaxed configuration
  • [ ] Add noImplicitAny to the tsconfig.json and apply required types
  • [ ] Include the .d.ts file along with the npm module

Feedback on the approach welcomed.

All 22 comments

+1

+1 :+1:

+1

yes absolutely! this project really needs a typescript definition file....

I took a stab at generating Typescript definitions based on the endpoint data from Google's discovery API. Disclaimer: I'm fairly new to all things Node & Typescript. Caveat emptor. Anyhow, typings available in the dist folder: https://github.com/procrastinatos/google-api-nodejs-tsd

It seams that with the new SALSA technology, typescript will be able to recognize things without .d.ts - there is a pull request enable this things.

+1

+1

+1

+1

Any news on this? Typings would greatly improve our experience working with this library.

+1

Since Typescript 2.1 you can import Untyped modules
So you can do
import * as google from "googleapis";

But for that, we need to update the package.json file and change main to "main": "./lib/googleapis.js",

I'm starting to work on this one. This has to be done over several PRs, but the plan is:

  • [x] Perform a basic update the files to *.ts and wire up the compiler (#731)
  • [x] Introduce arrow functions, const, let, and other basics (#732)
  • [x] Fix syntax to move towards classes and es6 style imports
  • [ ] Introduce tslint with relaxed configuration
  • [ ] Add noImplicitAny to the tsconfig.json and apply required types
  • [ ] Include the .d.ts file along with the npm module

Feedback on the approach welcomed.

hey @JustinBeckwith any update on this? You also don't need a .d.ts file since the code is written in typescript. The typedefs should be baked into the code itself. Otherwise the simple fix would have been to leave all of the code as it was and simply include a .d.ts. file to describe the structure of the JS package to the ts compiler.

Axios is a good example of this approach.

To add to the above comment: Despite the .ts file extensions, my compiler doesn't pick up any type information from this repo. Hence I'm forced to write my own googleapis.d.ts file in my project. Is there some configuration I need to do on my tsconfig in order to start inferring types from a typescript-based module?

@JustinBeckwith Any update on this? Super keen for these types.

Apologies for the delay here folks. We did a lot of work to get things moved over to typescript, but I just haven't gone the last mile to get the generated d.ts included in the package. There's a PR over in #785 to cover this :)

@JustinBeckwith Looks like #785 been merged. Would be amazing to get a new version with this and the types field in package.json set! :)

@JustinBeckwith any news on this?

BUMP. Any news?

Yes! We do ship a d.ts today. It's not terribly useful, because we don't have type information for the majority of the APIs. Most of the infrastructure is in place, but there's a lot of work left to generate better TypeScript for the libs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Thammawat picture Thammawat  路  29Comments

bradvogel picture bradvogel  路  25Comments

TaridaGeorge picture TaridaGeorge  路  17Comments

ihodes picture ihodes  路  15Comments

lukesneeringer picture lukesneeringer  路  18Comments