google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

Typescript definition file

Open Bigous opened this issue 10 years ago • 25 comments

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

Bigous avatar Jan 13 '16 12:01 Bigous

+1

isman-usoh avatar Jan 28 '16 04:01 isman-usoh

+1 :+1:

panKt avatar Jan 28 '16 05:01 panKt

+1

robby-cornelissen avatar Feb 08 '16 10:02 robby-cornelissen

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

christhomas avatar Feb 20 '16 17:02 christhomas

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

robby-cornelissen avatar Feb 21 '16 04:02 robby-cornelissen

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.

Bigous avatar Feb 22 '16 20:02 Bigous

+1

VamshiKrishnaAlladi avatar Jul 19 '16 09:07 VamshiKrishnaAlladi

+1

arondesign avatar Aug 01 '16 03:08 arondesign

+1

n-sviridenko avatar Sep 28 '16 17:09 n-sviridenko

+1

danieloprado avatar Nov 17 '16 17:11 danieloprado

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

masimplo avatar Nov 28 '16 13:11 masimplo

+1

abruneau avatar Jan 11 '17 17:01 abruneau

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",

abruneau avatar Jan 12 '17 13:01 abruneau

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.

JustinBeckwith avatar Apr 24 '17 05:04 JustinBeckwith

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.

supermacro avatar Oct 12 '17 18:10 supermacro

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?

supermacro avatar Oct 12 '17 18:10 supermacro

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

martywins avatar Nov 03 '17 11:11 martywins

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 avatar Nov 03 '17 17:11 JustinBeckwith

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

bjrnt avatar Nov 08 '17 07:11 bjrnt

@JustinBeckwith any news on this?

0x80 avatar Dec 02 '17 17:12 0x80