Typedoc: Typescript 1.7 compiler support

Created on 3 Dec 2015  Â·  19Comments  Â·  Source: TypeStrong/typedoc

Howdy,

With the recent release of the typescript 1.7 compiler we have been looking to upgrade our typescript code base. However typedoc will not be able to process the source correctly as the 1.6 compiler doesn't understand the new features - 'this' typing, exponential operator and async/await,

What is the status of this project is it still being actively maintained? Is 1.7 support in the works?

Thanks, and great work so far!

enhancement

Most helpful comment

BTW I have a fork that works with 1.7.5 thanks to @ThaNarie which can be npm installed via npm install jeffbcross/typedoc.

I tried upgrading to 1.8.9 but it generated empty docs, and I don't have time right now to figure out why :).

All 19 comments

Hi, nice to hear from you. Support for TypeScript 1.7 will be available with TypeDoc 0.4. This is a free time project and I've been quite busy lately so I'm sorry for not being able to tell you when v0.4 will be ready.

FYI, I got typedoc to compile in 1.7.3 using this patch:

diff --git a/src/td/models/Reflection.ts b/src/td/models/Reflection.ts
index d86da8d..7977697 100644
--- a/src/td/models/Reflection.ts
+++ b/src/td/models/Reflection.ts
@@ -440,7 +440,7 @@ module td.models
                     alias = 'reflection-' + this.id;
                 }

-                var target = this as Reflection;
+                var target: Reflection = this;
                 while (target.parent && !(target.parent instanceof ProjectReflection) && !target.hasOwnDocument) {
                     target = target.parent;
                 }

However, it just generates blank templates, so something is still wrong.

I don't know much about the internals of typedoc -- do you have a pointer for files or classes that should be constructed with, say, the test data set, so I can try to see where things are going wrong?

I worked some more on this. As in #122, I had to update the tsc.d.ts file, and remove the last line of it (export = ts;) to get it to compile.

As you can probably guess, then I got a handful of compilation warnings. It seems that a lot of functions are different.

Edit: here are the errors I have now:

typedoc/src/td/Options.ts(316,16): error TS2339: Property 'optionDeclarations' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(316,54): error TS2305: Module 'ts' has no exported member 'CommandLineOption'.
typedoc/src/td/Options.ts(339,44): error TS2339: Property 'createCompilerDiagnostic' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(345,29): error TS2339: Property 'Diagnostics' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(348,29): error TS2339: Property 'Diagnostics' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(380,20): error TS2339: Property 'hasProperty' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(384,20): error TS2339: Property 'hasProperty' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(467,46): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(471,58): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(596,46): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(598,53): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(599,62): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(645,72): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(649,51): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(651,77): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(660,54): error TS2339: Property 'CharacterCodes' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(678,35): error TS2339: Property 'compareValues' does not exist on type 'typeof ts'.
typedoc/src/td/Options.ts(768,28): error TS2339: Property 'hasProperty' does not exist on type 'typeof ts'.
typedoc/src/td/Utils.ts(16,19): error TS2339: Property 'normalizePath' does not exist on type 'typeof ts'.
typedoc/src/td/Utils.ts(27,16): error TS2339: Property 'hasProperty' does not exist on type 'typeof ts'.
typedoc/src/td/Utils.ts(46,39): error TS2339: Property 'getRootLength' does not exist on type 'typeof ts'.
typedoc/src/td/Utils.ts(47,38): error TS2339: Property 'getDirectoryPath' does not exist on type 'typeof ts'.
typedoc/src/td/Utils.ts(66,39): error TS2339: Property 'getDirectoryPath' does not exist on type 'typeof ts'.
typedoc/src/td/Utils.ts(66,59): error TS2339: Property 'normalizePath' does not exist on type 'typeof ts'.
typedoc/src/td/converter/Context.ts(147,30): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/Context.ts(148,74): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/Context.ts(178,25): error TS2339: Property 'id' does not exist on type 'Symbol'.
typedoc/src/td/converter/Context.ts(178,36): error TS2339: Property 'id' does not exist on type 'Symbol'.
typedoc/src/td/converter/Context.ts(179,27): error TS2339: Property 'id' does not exist on type 'Symbol'.
typedoc/src/td/converter/Context.ts(196,70): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/Context.ts(235,36): error TS2339: Property 'isDeclarationFile' does not exist on type 'typeof ts'.
typedoc/src/td/converter/Context.ts(321,26): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/Context.ts(322,52): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/Context.ts(376,40): error TS2339: Property 'symbol' does not exist on type 'TypeParameterDeclaration'.
typedoc/src/td/converter/Converter.ts(291,35): error TS2339: Property 'normalizePath' does not exist on type 'typeof ts'.
typedoc/src/td/converter/Converter.ts(291,52): error TS2339: Property 'normalizeSlashes' does not exist on type 'typeof ts'.
typedoc/src/td/converter/Converter.ts(418,27): error TS2339: Property 'getDirectoryPath' does not exist on type 'typeof ts'.
typedoc/src/td/converter/Converter.ts(418,47): error TS2339: Property 'normalizePath' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(29,33): error TS2339: Property 'getSourceFileOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(49,57): error TS2339: Property 'fileName' does not exist on type 'Node'.
typedoc/src/td/converter/converters/convertNode.ts(55,27): error TS2339: Property 'getSourceFileOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(57,22): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/convertNode.ts(60,64): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/convertNode.ts(272,31): error TS2339: Property 'getClassExtendsHeritageClauseElement' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(287,39): error TS2339: Property 'getClassImplementsHeritageClauseElements' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(325,32): error TS2339: Property 'getInterfaceBaseTypeNodes' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(357,24): error TS2339: Property 'isBindingPattern' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(389,42): error TS2339: Property 'symbol' does not exist on type 'VariableDeclaration'.
typedoc/src/td/converter/converters/convertNode.ts(396,16): error TS2339: Property 'isBindingPattern' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(398,27): error TS2339: Property 'declarationNameToString' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(450,20): error TS2339: Property 'isBindingPattern' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertNode.ts(721,34): error TS2339: Property 'symbol' does not exist on type 'Declaration'.
typedoc/src/td/converter/converters/convertNode.ts(722,80): error TS2339: Property 'symbol' does not exist on type 'Declaration'.
typedoc/src/td/converter/converters/convertType.ts(44,43): error TS2339: Property 'Intrinsic' does not exist on type 'typeof TypeFlags'.
typedoc/src/td/converter/converters/convertType.ts(45,49): error TS2305: Module 'ts' has no exported member 'IntrinsicType'.
typedoc/src/td/converter/converters/convertType.ts(84,27): error TS2339: Property 'getTextOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertType.ts(159,23): error TS2339: Property 'getTextOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertType.ts(273,35): error TS2339: Property 'getTextOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/convertType.ts(336,43): error TS2305: Module 'ts' has no exported member 'IntrinsicType'.
typedoc/src/td/converter/converters/factories.ts(32,23): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/factories.ts(33,25): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/factories.ts(129,78): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/factories.ts(131,81): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/factories.ts(165,75): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/factories.ts(167,78): error TS2339: Property 'symbol' does not exist on type 'Node'.
typedoc/src/td/converter/converters/factories.ts(190,37): error TS2339: Property 'parent' does not exist on type 'Symbol'.
typedoc/src/td/converter/converters/factories.ts(191,50): error TS2339: Property 'parent' does not exist on type 'Symbol'.
typedoc/src/td/converter/converters/factories.ts(223,77): error TS2339: Property 'symbol' does not exist on type 'SignatureDeclaration'.
typedoc/src/td/converter/converters/factories.ts(269,72): error TS2339: Property 'symbol' does not exist on type 'ParameterDeclaration'.
typedoc/src/td/converter/converters/factories.ts(272,20): error TS2339: Property 'isBindingPattern' does not exist on type 'typeof ts'.
typedoc/src/td/converter/converters/factories.ts(302,35): error TS2339: Property 'symbol' does not exist on type 'TypeParameterDeclaration'.
typedoc/src/td/converter/plugins/CommentPlugin.ts(283,33): error TS2339: Property 'getSourceFileOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/plugins/CommentPlugin.ts(290,26): error TS2339: Property 'nextContainer' does not exist on type 'Node'.
typedoc/src/td/converter/plugins/CommentPlugin.ts(290,48): error TS2339: Property 'nextContainer' does not exist on type 'Node'.
typedoc/src/td/converter/plugins/CommentPlugin.ts(292,52): error TS2339: Property 'nextContainer' does not exist on type 'Node'.
typedoc/src/td/converter/plugins/CommentPlugin.ts(314,31): error TS2339: Property 'getJsDocComments' does not exist on type 'typeof ts'.
typedoc/src/td/converter/plugins/DecoratorPlugin.ts(36,49): error TS2339: Property 'getTextOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/plugins/DecoratorPlugin.ts(39,43): error TS2339: Property 'getTextOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/plugins/DecoratorPlugin.ts(83,30): error TS2339: Property 'getTextOfNode' does not exist on type 'typeof ts'.
typedoc/src/td/converter/plugins/SourcePlugin.ts(86,38): error TS2339: Property 'getSourceFileOfNode' does not exist on type 'typeof ts'.

:+1:

I'm new to typedoc, would someone mind clarifying how to force typedoc to use the TS 1.7 compiler please? "typedoc --version" shows me: "TypeDoc 0.3.12
Using TypeScript 1.6.2 from ...", while I would have expected it would use 1.7 in the latest npm package.

There hasn't been a release with the support for typescript 1.7 yet. The last release is from "7 Oct 2015" and the typescript 1.7 support is only 1 month old

@ocombe - when I try installing from github using "https://github.com/sebastian-lenz/typedoc.git#53bb762" - it seems to depend on "[email protected]", which is not checked into the typedoc-default-themes repo. Would love to see polymorphic "this" typing light up, as described here: http://blogs.msdn.com/b/typescript/archive/2015/11/30/announcing-typescript-1-7.aspx. Today typedoc fails compiling on such code.

I wanted to see what the state of the 1.7 version was, so I cloned and npm-linked the repo in my (very small test) project. For it to work I had to:

Without the change you end up with this output (added extra log):

Using TypeScript 1.7.3 from /Volumes/Projects/Repos/typedoc/node_modules/typescript/lib
/Volumes/Projects/Repos/typedoc/node_modules/typescript/lib/lib/lib.d.ts
Error: Cannot find global type 'Array'.
...

Additional note; In a previous commit the project structure has changed where bin/typedoc now references files from the /lib folder, instead of a compiled version from the /bin folder.

The /lib folder isn't listed in the package.json "files" section, so it won't be included when you install it from Github via the package.json.

When you add the folder (together with the changes above), it will install and run correctly.

typescript is on 1.8 now so you may want to also include that version with the issue

Well, 1.8 is still beta, not released.

1.8 is now final.

You can force use typescript installed in your project by running:
rm -rf node_modules/typedoc/node_modules/typescript

But don't sure if it will work without any issues :)

Just for info: I'm making another doc generator called docscript which uses different architecture. I don't think that it can be useful right now for production purposes, and a lot of work must be done before the first public release. But docscript aims to support the latest TS compiler and successfully builds docs even for 1.9 nightly compiler.

So maybe in the next few weeks all missing features will be implemented and it will be ready to use. If someone is interested to be early adopters — you're welcome.

The /lib folder isn't listed in the package.json "files" section, so it won't be included when you install it from Github via the package.json.

@ThaNarie it looks like the default grunt task generates the lib folder. So if you npm install typedoc from Github as a dependency, you'll also have to run Grunt inside the project.

BTW I have a fork that works with 1.7.5 thanks to @ThaNarie which can be npm installed via npm install jeffbcross/typedoc.

I tried upgrading to 1.8.9 but it generated empty docs, and I don't have time right now to figure out why :).

FYI, this also looks like a very promising way to do docs: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#using-the-type-checker

It uses an unstable, but at least public and supported, API.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bibliofile picture Bibliofile  Â·  3Comments

atomsoftwarestudios picture atomsoftwarestudios  Â·  4Comments

topherfangio picture topherfangio  Â·  3Comments

pushkov-fedor picture pushkov-fedor  Â·  3Comments

cfischer picture cfischer  Â·  4Comments