Skip to content
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

Update typescript version #4

Open
michaelmesser opened this issue May 27, 2016 · 12 comments
Open

Update typescript version #4

michaelmesser opened this issue May 27, 2016 · 12 comments

Comments

@michaelmesser
Copy link

Update typescript version

@SomaticIT
Copy link

Hi,

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

Thanks.

@SomaticIT SomaticIT reopened this May 28, 2016
@huan
Copy link

huan commented Feb 11, 2017

Should be TypeScript v2.1 today...

@SomaticIT
Copy link

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

@jimsugg
Copy link

jimsugg commented May 5, 2017

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

@SomaticIT
Copy link

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 :

  • Updates project dependencies
  • Updates project build dependencies
  • Update project typings
  • Update the forked tsc.ts from typescript source repo Patch
  • 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 to do our processing directly during Typescript compilation.

Again thank you for your contribution.

@jimsugg
Copy link

jimsugg commented May 5, 2017 via email

@jimsugg
Copy link

jimsugg commented May 7, 2017

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
Copy link

SomaticIT commented May 8, 2017

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
Copy link

jimsugg commented May 29, 2017

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
Copy link

SomaticIT commented May 30, 2017

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
Copy link

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

@SomaticIT
Copy link

Yes i fixed it sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants