Typescript definition file
Could you include the d.ts file in this client distribution?
+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
*.tsand 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
noImplicitAnyto thetsconfig.jsonand apply required types - [ ] Include the
.d.tsfile 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?