-
Notifications
You must be signed in to change notification settings - Fork 595
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
TypeScript type definitions #952
Comments
UPDATE: 5/9/18We are moving some libraries to TypeScript. We're getting there, please subscribe to this issue for updates :) Original post, 11/19/15 I think this would be a cool thing, but I'm not sure it's the right time, and possibly not the right place. ⌛ Time We haven't stabilized to the point we're comfortable tagging 1.0. We're still making pretty sweeping changes, so adding the weight of maintaining the definition file could quickly lead to inconsistencies. However, the suggestion of dox -> definition file makes a lot of sense... if there was such a transformer, we could easily integrate that at any time and not worry about inconsistencies. 🌎 Place I came across this: https://github.com/DefinitelyTyped/DefinitelyTyped, which looks to be hosting definition files for popular libraries, where the definition files are contributed by the community and not the authors of the library. This separation would be nice, since choosing to support TypeScript and shipping our own definition files caters to only one of many possible use cases. Having a separate place and the help from the community would be really nice. |
The issue with https://github.com/DefinitelyTyped/DefinitelyTyped is that these type definitions are not versionned with the underlying repos, which makes TypeScript useless if the thirdparty has an API change but the type definitions haven't been updated (i.e., the compiler won't fail). For that reason, as far as I'm aware, the TypeScript team is currently pushing for the type definitions to be hosted directly in the projects' repos and specified in the Fair point on the 1.0 though. Unfortunately I'm not aware of any |
Let's keep this open and see if we get more input. 1.0 is probably, almost definitely, not going to happen before February 2016, so we have a while to see what conventions might develop in the meantime. Until then, the DefinitelyTyped solution would be the best solution. If you (or anyone seeing this) decides to pop us in there, ping me anytime if there are any questions along the way that I can help with. |
i wrote my own definitions _for datastore_, i am going to publish the definitions on definitelyTyped but haven't done so yet (haven't debugged/tested my app yet) here's the definitions for you if you like |
by the way, the datastore api does seem a bit immature (besides the obvious no Promises) so i'm not so sure writing typings is so important at this point. I write typings because it helps me learn a new api. |
Thanks for sharing that!
Yeah, it will be shaken up pretty good by #897. |
This came up in the node.js blog post btw: Also highly sought after in the google api node.js client: |
FYI, you can distribute an |
We're also using this library with TypeScript and could really use a type definition for it. As mentioned above, just including a simple |
We're using this atm, but it's just some patchwork to try and give us some basic typing in our code. But we keep hitting cases where we need to add more, which causes productivity slow downs.
|
I think it would be better if the type declarations were maintained here, rather than in DefintielyTyped. They can be referenced from a One thing that would help TypeScript declarations, and future ECMAScript module compatibility would be to not export functions as modules with code like import {Datastore} from '@google-cloud/datastore'; |
quick update - I spent a couple of days on this and really got nowhere. From what I can tell by looking at a lot of the auto-gen'd libs, we should really be generating a set of .d.ts definitions from the .proto definitions for api/ver. This is a little too much work for me at the moment. As an aside -- I ran across this: https://github.com/Microsoft/dts-gen When I get some time in the next couple of weeks, I'll give it a go. |
i mentioned this before, but I wrote (hand written) definitions for cloud datastore, anyone who wants feel free to use it: https://gist.github.com/jasonswearingen/b2619b1d7d4991452131 I was going to publish on DefinitelyTyped but never got around to it. |
I too would be interested in seeing this support come to existence, as AWS and Azure both have typings available—excited to see progress on this. |
I'm going to throw my voice in for this -- typescript is gaining in popularity (3x higher as a search term since when this issue was created) and it would be great to get official support. |
Not to mention Google just accepted Typescript as an officially supported internal language. I've been waiting to see how the language is adopted for a few years now and I'm finally biting the bullet and kicking off a new project with it. One that uses google-cloud APIs. Definitely throwing my 👍 on this |
At this point, this is probably something we are going to do. However, I can not yet give any reliable promise on when / the timing. |
Adding my 👍 to add Typescript defintion |
btw, now you can install via npm:
|
Just submitted a PR. Hopefully it's published soon 🤞 |
@beaulac It's just for datastore though, no? |
@julien-c Yes, indeed. Sorry to get your hopes up 😓 Considering the large number of different packages (in varying alpha/beta/GA states), it might be more useful to track definition requests specifically per service. |
Maybe worth raising a concern internally over having this as a more formalized effort then? |
I would be more than willing to help with this effort. I have a little experience doing this from updating the definitions for |
@lukesneeringer we know a lot more about our project now than we did in April-- we've relocated repos from the monorepo, introduced more GAPICs, and reached more GA's. Considering our course is getting more stable, is there any update for this issue? |
@laurentgoudet please add dialogflow to this list! |
Hope bigtable is included soon |
Isn't there a way to compile GRPC Types to Typescript? So wouldn't a compiler to Typescript simplify, make things scalable and keep everything up-to-date? |
@JustinBeckwith Can you give an update on the state of this issue? |
@grant for our gRPC-based libraries, we're gradually moving towards TypeScript-based generators, rather than JavaScript; as we make this migration, these libraries ( |
Any news on type decls for googleapis/nodejs-compute (aka |
Greetings @garyo! That is the one module that likely won't be getting types 😬 I would highly recommend using https://github.com/googleapis/google-api-nodejs-client instead. |
I see, thanks @JustinBeckwith . I'll check out this new module. If that old module is deprecated (?) then maybe something in the README would be useful. There's a lot of examples floating around out there using Hmm, just looking at |
Yeah, it's not deprecated as of now, but there's so much code it would take a very, very long time to support types. On the samples - great point! Before we even considered deprecating that module, we would need to have a plan in place. |
Folks - I think we're ready to call this one :) There may be one or two stragglers out there, but we should be able to follow up as needed with package specific bugs. Thanks for being patient here! And please do let us know if we missed anything. |
Great work @JustinBeckwith and team -- really appreciate it |
@alexander-fenster, @xiaozhenliu-gg5, @summer-ji-eng, @bcoe, @jkwlui did all the real work 🙃 |
@garyo did you open an issue about the missing |
Yes, it's googleapis/google-api-nodejs-client#1915 -- still open. |
@JustinBeckwith wrote:
Just saw something you may find interesting: googleapis/nodejs-compute#534 -- It looks like it adds type decls to the compute module |
How can I import types for cloud-vision? I can't find a way to do it. Seems it's all not exported :/ |
@moreiravictor what have you tried? |
@JustinBeckwith tried importing it from @google-cloud/vision module |
docs: add the fields for setting CX virtual agent session parameters PiperOrigin-RevId: 446825520 Source-Link: googleapis/googleapis@f6bb255 Source-Link: googleapis/googleapis-gen@cd1450b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2QxNDUwYjQwM2I1YTNmOTI2NzZkOGEzNGYwY2ZjMDdmYzc2N2I0MCJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md feat: add the API of StreamingAnalyzeContent PiperOrigin-RevId: 446850583 Source-Link: googleapis/googleapis@b9927eb Source-Link: googleapis/googleapis-gen@d442854 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDQ0Mjg1NDk5YTBlNzU3ZTY4ZDM5ZGMxOGY5MWQyODAwNjk0YWQ5MCJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
chore: relocate owl bot post processor
UPDATE: We are going to do this across the board. We will use this issue to track each repository.
Now that TypeScript has a much better support for the npm ecosystem (https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages), it'll be great if you guys could ship type definitions alongside the package. Maybe there's way to do it during release from the
dox
JSON output files.The text was updated successfully, but these errors were encountered: