Right now Typedoc is using TS 3.5.3 and version 3.7.0 comes with major features that will probably break docs using new TS, for example I tried to use Optional Chaining and I receive the following error
Using TypeScript 3.5.3 from /home/nicolas.mahecha/vs/venue-map-component/node_modules/typedoc/node_modules/typescript/lib
Error: /home/nicolas.mahecha/vs/venue-map-component/src/VenueMap.ts(434)
Expression expected.
Error: /home/nicolas.mahecha/vs/venue-map-component/src/VenueMap.ts(434)
Expression expected.
Error: /home/nicolas.mahecha/vs/venue-map-component/src/VenueMap.ts(434)
':' expected.
For the following code which compiles correctly
const seatingCenter = isRow ? this._mapMetadata.sections[seatingId]?.rows.center : this._mapMetadata.sections[seatingId]?.center;
Updating to typescript@next should allow to start working with these new features and work off in changes for typedoc itself
Thank you guys for the awesome work, I hope to see this soon in order to start working with 3.7 features and having the documented
I'm using yarn,
adding:
"resolutions": {
"typescript": "^3.7.0-dev.20191004"
}
in the package json forces typedoc to use that version, and it works for me
I think TypeDoc should probably wait to upgrade to 3.7 until it releases outside of a beta branch. We still use internal compiler APIs & thus cannot guarantee that even a minor upgrade to TypeScript won't break the tool.
Can confirm forcing TypeDoc to use 3.7.0-beta does work without errors when run over code using both optional chaining and null coalescence ops.
That being said, I agree that it's totally fair to wait for an official release for safety's sake. Better safe than sorry when relying on internal APIs.
I think a more proper solution would be to make typescript a peer dependency of this project, and by default use whatever version the end user is working with (sorry if this has been discussed before, just found this project and looking to use it!).
Agreed. I've currently resorted to adding this to my docs build workflow:
- name: Install dependencies
run: |
npm install
# Replace typedoc's typescript dep with currently installed version
# because it comes with an incompatible version
rm -rf ./node_modules/typedoc/node_modules/typescript
cp -r ./node_modules/typescript ./node_modules/typedoc/node_modules/typescript
which solves the problem for now. I just have to remember to do so manually when working on my theme locally if I have to make any changes to my dependencies.
We would like to eventually switch to a peer dependency, but this isn't possible right now because we use internal APIs that can break even at a minor update. #720, #880
Officially TS 3.7 is now the latest stable version (Including optional chaining)
https://github.com/microsoft/TypeScript/releases/tag/v3.7.2
So we can use this issue to track when we can use this features out of the box with typedoc (for them to update their version)
This should be fixed when #1129 is merged.
Version 0.15.1 is now published with support for TS 3.7 :)
Most helpful comment
Version 0.15.1 is now published with support for TS 3.7 :)