-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Suggestion: generate typescript declarations using angular/clutz (Closure to TypeScript .d.ts
generator)
#1826
Comments
@Bnaya I've unsuccessfully spent quite a bit of time convincing closure to work with node.js codebase. What's the goal of this? As I've heard from VSCode users, suggestions work really nice with puppeteer. +cc @JoelEinbinder |
@aslushnikov, vscode ain't typescript, for typescript project you still need to install the @types/puppeteer, (which is manually managed, and not aligned with the actual puppeteer api) I will try to do it myself, |
types@puppeteer is an external project which appears maintained: https://www.npmjs.com/package/@types/puppeteer Without built in support from typescript itself, I don’t think it’s a big enough win for us to create our own d.ts files. |
One thing most developers do not pay attention is that there are a lot of flavours of JSDoc and not all of them compatible. For example: I learned this idea from "state of documentation.js" post. Here is a full list of JSDoc flavours that I'm aware of. |
@JoelEinbinder, its not up to date with 1.0, and also using dom, symbols, (not clear to me why). it's forcing the user to also add the dom lib to the tsconfig even its a node project. |
@Bnaya, Because of the way we handle evaluation in Chromium, Elements can appear as the arguments to page functions. As stereobooster mentions, JSDoc is not very consistent. Moving from closure style JSDoc to typescript style JSDoc was a large project, and I'm not very excited to add a third JSDoc parser into the mix in parallel. |
Looks like there's activity at microsoft/TypeScript#20735, with emitting types from typescript-jsdocs |
This is the PR you probably want: microsoft/TypeScript#21455 The goal is to enable tons of pure js projects just like puppeteer to automatically generate .d.ts files as part of build. I will be using puppeteer as a real world example to test this out. I'll create a PR with auto-generated declarations for your feedback. Do you know of other projects with well documented jsdoc types that I should be aware of? |
As Allow
--declaration
with--allowJs
TypeScript/issues/7546 has no clear due date (future milestone)I think it would be very helpful to find alternative way to generate high-quality and correct typescript declarations.
Angular has https://github.com/angular/clutz, which is:
Closure to TypeScript
.d.tsgenerator
And because
puppeteer
already have Closure compiler annotations that passes typescript linting, I assume it should be trivial for someone who knows Closure well to use it to generate declarations.(I tired myself, had issues with nodejs externes. i will continue trying when i will find time)
Related #1170
The text was updated successfully, but these errors were encountered: