spatools / ts2jsdoc

A JSDoc plugin with an optional template which automatically adds JSDoc comments based on Typescript definitions.
MIT License
13 stars 5 forks source link

Update typescript version #4

Open michaelmesser opened 8 years ago

michaelmesser commented 8 years ago

Update typescript version

SomaticIT commented 8 years ago

Hi,

We are running out of time. We look for volunteers to help upgrading ts2jsdoc to Typescript 1.8.

Thanks.

huan commented 7 years ago

Should be TypeScript v2.1 today...

SomaticIT commented 7 years ago

Hi @zixia, Are you interested in upgrading TypeScript in this project as a PR ? Thanks

jimsugg commented 7 years ago

I would be wiling to help in upgrading for Typescript 2.3. Whatever guidance you could provide to get started would be great.

SomaticIT commented 7 years ago

Hi @jimsugg,

I'm really happy to help you in upgrading to Typescript 2.3.

Here is a first task list to upgrade this project :

This looks intimidating but a lot of features are really simple to process. Take a look at the project's source code and tell me if you need more help. Main files are :

Also, we could maybe plug into the new Language Service Extensibility to do our processing directly during Typescript compilation.

Again thank you for your contribution.

jimsugg commented 7 years ago

Hi -

Thanks very much for this.

I am in the process of familiarizing myself with the internal structure of ts2jsdoc.

I cloned the ts2jsdoc repo and started the process of making it at least buildable with TS 2.3, specifically working (so far) on your top 3 points below, and to some degree point #5. Thanks for mentioning point # 4 - I hadn’t realized yet that you were forking and using the TS compiler.

As I move forward, I will send you some brief updates and notes on what I have done, in case you see anything that you may wish to comment on.

With regard to typings, I want to (as much as possible) remove the dependence on that, and use the new @types npm repository and/or the Typescript declarations included with packages. It still seems like we still need a ’typings’ definition for jsDoc, since there don’t seem to be any jsDoc declaration files that are being maintained.

The first task is just to eliminate obvious errors, based on the new Typescript definitions. This should cover much of what you note in your point # 5.

Once I get through this phase, I will build this and try to run it, before I start on the new TS features. Just as a first milestone, I would like to see it work ok at least with the older features.

Making progress - will report back when I am farther along.

Thanks, Jim

On May 5, 2017, at 3:57 AM, Maxime LUCE notifications@github.com wrote:

Hi @jimsugg https://github.com/jimsugg,

I'm really happy to help you in upgrading to Typescript 2.3.

Here is a first task list to upgrade this project :

Updates project dependencies Updates project build dependencies Update project typings Update the forked tsc.ts from typescript source repo Patch https://github.com/spatools/ts2jsdoc/blob/master/lib/tsc.ts#L607 Fix issues with new TypeScript AST (mostly in lib/processor.ts and lib/syntax.ts) Add missing TypeScript features : Spread operators Destructured parameters Generators Generic inline types Typeguard functions Intersection Types Class expressions abstract Number, boolean, and Enum literal types never Type readonly Non nullable types Optional properties in class await / async ? Mapped Types keyof object Type Mixin Classes Generic defaults This looks intimidating but a lot of features are really simple to process. Take a look at the project's source code and tell me if you need more help. Main files are :

lib/ast.ts: Entry point (look at compile and getFileComments functions) lib/processor.ts: Detect AST node and call the good extractor (process function) lib/syntax.ts: Contains functions for each AST node type. Also, we could maybe plug into the new Language Service Extensibility https://github.com/Microsoft/TypeScript/issues/6508 to do our processing directly during Typescript compilation.

Again thank you for your contribution.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spatools/ts2jsdoc/issues/4#issuecomment-299471446, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGS0BY2TY0RtIR1cdiyFhG_Q3UlS7qcks5r2yrCgaJpZM4Ioxts.

jimsugg commented 7 years ago

It looks like the only reason for the forked tsc.ts is to be able to use ts2jsdoc globally as a standalone converter. Is that the case?

SomaticIT commented 7 years ago

Hi @jimsugg,

Thank you for your report.

  1. You're right, the forked tsc.ts is only here to be able to run ts2jsdoc as a binary which takes the same options as tsc. If you look to the module it is not the built version but the source version available in TypeScript repository. The fix is available on line 607 in ts2jsdoc.

  2. I agree to remove typings dependencies by using @types npm packages.

  3. You're on the good way, I think we should consolidate old features by upgrading our AST processor. Then we will be able to add smoothly all new features available in TypeScript.

Do not hesitate to ask me if you need more information.

Thanks Max

jimsugg commented 7 years ago

I haven't forgotten this project. I have it transpiling and running with TS 2.3, but there are still things to be worked out with parsing. Also, for new features (e.g., a function that returns a tuple,) I am running into issues in jsDoc with the type parser, and these need to be sorted out. If you have any thoughts on potential issues with jsDoc type parsing limitations, let me know. There is an interesting comment in the jsDoc code that implies the maintainers have considered supporting plugins for type parsing.

SomaticIT commented 7 years ago

Hi @jimsugg,

No problem, time is sometimes hard to find! I'm happy you achieve upgrading the core project to make it run with TS 2.3.

  1. For the Tuple type, we can use a return type of Tuple with the ts2jsdoc's specific @generic tag which contains the content types of the Tuple. By default the template should write that in the form Tuple<T1, T2, ...>. We can improve it by detecting the Tuple type and write it in the form [T1, T2, ...].

  2. It is totally possible to improve jsDoc type parser and add custom tags. In fact, ts2jsdoc already include a plugin for jsDoc: plugin.js. It currently includes:

    • @ctor: Allow to separate class from constructor (and multiple constructor) ;
    • @callsignature: Multiple function call signatures ;
    • @ctorsignature: Interface constructor signatures ;
    • @enum: Special typedef ;
    • @generic: Specify generic parameters for types and return types.
  3. Do you want to include your first commits in a pull request so I could review it and merge it in a new ts23-upgrade branch? It would be a good common base for us to work.

Thanks for your work Max

BurtHarris commented 7 years ago

@SomaticIT, hello. Your last post mentioned tsdoc, were you referring to ts2jsdoc?

SomaticIT commented 7 years ago

Yes i fixed it sorry!