Skip to content

Add support for TypeScript 4.3 #1589

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

Closed
doberkofler opened this issue May 26, 2021 · 37 comments
Closed

Add support for TypeScript 4.3 #1589

doberkofler opened this issue May 26, 2021 · 37 comments

Comments

@doberkofler
Copy link

Search Terms

TypeScript 4.3

Problem

npm ERR! Could not resolve dependency:
npm ERR! peer typescript@"3.9.x || 4.0.x || 4.1.x || 4.2.x" from [email protected]

Suggested Solution

Support TypeScript 4.3

@simllll
Copy link
Contributor

simllll commented May 26, 2021

Right now it fails on my side with following error message:

Warning: You are running with an unsupported TypeScript version! TypeDoc supports 3.9, 4.0, 4.1, 4.2
lerna ERR! npm run generate:docs stderr:
TypeDoc exiting with unexpected error:
TypeError: Cannot read property 'kind' of undefined
    at Object.isDeclaration (/buddy/hokify-justin/hokify-justin/node_modules/typescript/lib/typescript.js:13449:18)
    at Object.isDeclarationName (/buddy/hokify-justin/hokify-justin/node_modules/typescript/lib/typescript.js:16414:75)
    at getTypeOfSymbolAtLocation (/buddy/hokify-justin/hokify-justin/node_modules/typescript/lib/typescript.js:66938:20)
    at Object.getTypeOfSymbolAtLocation (/buddy/hokify-justin/hokify-justin/node_modules/typescript/lib/typescript.js:45176:35)
    at Object.convertProperty (/buddy/hokify-justin/hokify-justin/node_modules/typedoc/dist/lib/converter/symbols.js:330:176)
    at convertSymbol (/buddy/hokify-justin/hokify-justin/node_modules/typedoc/dist/lib/converter/symbols.js:80:79)
    at convertSymbols (/buddy/hokify-justin/hokify-justin/node_modules/typedoc/dist/lib/converter/symbols.js:86:9)
    at Object.convertClassOrInterface (/buddy/hokify-justin/hokify-justin/node_modules/typedoc/dist/lib/converter/symbols.js:264:5)
    at Object.convertSymbol (/buddy/hokify-justin/hokify-justin/node_modules/typedoc/dist/lib/converter/symbols.js:80:79)
    at Converter.convertExports (/buddy/hokify-justin/hokify-justin/node_modules/typedoc/dist/lib/converter/converter.js:182:23)

let me know if I can help somehow!

Thanks

Shin-Ogata added a commit to Shin-Ogata/fieldwork that referenced this issue May 27, 2021
- 3rd library の更新
  - typescript 4.3.2 は TypeDoc がまだ未対応なので見送り
    TypeStrong/typedoc#1589
@chharvey
Copy link

chharvey commented May 27, 2021

Is there any particular reason why this

"peerDependencies": {
  "typescript": "3.9.x || 4.0.x || 4.1.x || 4.2.x"
},

isn’t this?

"peerDependencies": {
  "typescript": ">= 3.9"
},

@vladmandic
Copy link

vladmandic commented May 27, 2021

Right now it fails on my side with following error message:

Warning: You are running with an unsupported TypeScript version! TypeDoc supports 3.9, 4.0, 4.1, 4.2
lerna ERR! npm run generate:docs stderr:
TypeDoc exiting with unexpected error:
TypeError: Cannot read property 'kind' of undefined

In TypeScript function isDeclaration(node) somehow node param that is passed is undefined.

But error starts earlier in TypeDoc lib/converter/symbols.js
And code note actually says "This will probably break in a future TS version" - and I guess it did :(

  // FIXME: This is a horrible hack because getTypeOfSymbol is not exposed.
  // The right solution here is probably to keep track of parent nodes...
  // but that's tricky because not every reflection is guaranteed to have a
  // parent node. This will probably break in a future TS version.
  reflection.type = context.converter.convertType(context, (_c = (context.isConvertingTypeNode() ? parameterType : void 0)) !== null && _c !== void 0 ? _c : context.checker.getTypeOfSymbolAtLocation(symbol, {}));

Also, there are few other failed checks for undefined when attempting to build TypeDoc using new TS 4.3
So it can't be used with TS 4.3 nor it can be build with TS 4.3 - I hope this gets resolved, but doesn't look like a tiny fix

@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 29, 2021

This is probably going to be a weekend of June 5th fix - I likely won't have time before then :)

@krisztianb
Copy link
Contributor

krisztianb commented May 29, 2021

Is there any particular reason why this

"peerDependencies": {
  "typescript": "3.9.x || 4.0.x || 4.1.x || 4.2.x"
},

isn’t this?

"peerDependencies": {
  "typescript": ">= 3.9"
},

TypeScript updates often include breaking changes so it's not safe to simply state that TypeDoc supports every TS version above 3.9.

@chharvey
Copy link

@Gerrit0 In the short term, could you make typescript 4.2.x a dependency, and then add 4.3.x to the peer dependencies? That might let TypeDoc still use 4.2.x internally but let users install 4.3.x in their projects.

Shin-Ogata added a commit to Shin-Ogata/fieldwork that referenced this issue May 31, 2021
- i18next: 20.3.1
- testem: 3.4.2
- typescript 4.3.2 は TypeDoc がまだ未対応なので見送り
  TypeStrong/typedoc#1589
antondalgren added a commit to cloudamqp/amqp-client.js that referenced this issue May 31, 2021
Error when running typedoc with Typescript 4.3. TypeStrong/typedoc#1589
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 1, 2021

@chharvey doing this would break quite a few users that still use old versions of TS, so I don't really want to do that. I'll consider it if I can't get around to fixing it this coming weekend.

alanshaw pushed a commit to nftstorage/nft.storage that referenced this issue Jun 1, 2021
typedoc does not yet support typescript 4.3 TypeStrong/typedoc#1589
alanshaw pushed a commit to nftstorage/nft.storage that referenced this issue Jun 1, 2021
typedoc does not yet support typescript 4.3 TypeStrong/typedoc#1589
grahammcculloch added a commit to product-os/jellyfish that referenced this issue Jun 2, 2021
This is a temporary measure as Typedoc generation  will be broken when we upgrade to TypeScript v4.3 until Typedoc supports this version (should be very soon: TypeStrong/typedoc#1589 (comment)). At that point, we can re-instate this.

Change-type: patch
Signed-off-by: Graham McCulloch <[email protected]>
@sindresorhus
Copy link

TypeScript updates often include breaking changes so it's not safe to simply state that TypeDoc supports every TS version above 3.9.

I would personally take that risk rather than having the annoyance of having to wait for typedoc for every single minor version of TypeScript.

@krisztianb
Copy link
Contributor

It's just a warning. You can take the risk. As you can see it won't work this time. 😄

@doberkofler
Copy link
Author

I'm generally ok with the strict dependencies but maybe the actual need for the strict dependency could be relaxed. I don't know, how the interface between TypeDoc and TypeScript works but i believe that for example eslint abstracts aways the version specific details of language to be linted by using a dedicate abstraction layer.

@Nokel81
Copy link
Contributor

Nokel81 commented Jun 2, 2021

And code note actually says "This will probably break in a future TS version" - and I guess it did :(

Yeah... I just found that too, {} is not a valid Node (from TS POV) so I can understand why they didn't bother adding a check on name.parent.kind in the ts.isDeclaration function.

antondalgren added a commit to cloudamqp/amqp-client.js that referenced this issue Jun 3, 2021
Error when running typedoc with Typescript 4.3. TypeStrong/typedoc#1589
antondalgren added a commit to cloudamqp/amqp-client.js that referenced this issue Jun 3, 2021
Use typescript 4.2.x.

Error when running typedoc with Typescript 4.3. TypeStrong/typedoc#1589
Noah2610 added a commit to Noah2610/timesub that referenced this issue Jun 4, 2021
Downgrade typescript version because of typedoc bug.
TypeStrong/typedoc#1589
@Nokel81
Copy link
Contributor

Nokel81 commented Jun 8, 2021

Tested v0.21.0-beta.2 on www.github.com/lensapp/lens and it worked great!

gnarea added a commit to relaycorp/keystore-db-js that referenced this issue Jun 9, 2021
@Ayfri
Copy link

Ayfri commented Jun 10, 2021

Error: source/src/sprites/Text.ts:17:18 - error TS2612: Property 'background' will overwrite the base property in 'Container'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

public override background: Sprite;

With https://github.com/Ayfri/PIXI-Extended.
This is found in this file.

Configuration here : https://github.com/Ayfri/PIXI-Extended/blob/docs/typedoc.json.

@krisztianb
Copy link
Contributor

@Ayfri that's a compiler error you need to fix and not related to TypeDoc, is it?

@Ayfri
Copy link

Ayfri commented Jun 10, 2021

No, my code is fine. It's just because override is a new keyword introduced by TS 4.3 and normally TS 4.2 throws this error when falling on it, but in my project I use TS 4.3 and everything is fine. So I don't know 🤔

@krisztianb
Copy link
Contributor

So the code builds fine, but creating the docs with TypeDoc fails. Is that right?

@Ayfri
Copy link

Ayfri commented Jun 10, 2021

Exactly !

@krisztianb
Copy link
Contributor

Could it be that TypeDoc for whatever reason is still using TS 4.2 to compile your project? Looking at your package.json TypeDoc is not installed locally with your project. How do you build the docs?

@Ayfri
Copy link

Ayfri commented Jun 10, 2021

It's on the docs branch. I'm using a GitHub action to clone the master branch and generate the docs.

@krisztianb
Copy link
Contributor

Oh, I see. I don't know then. Still looks like a compilation error to me. Maybe you should create a smaller repo to narrow down the issue.

@Ayfri
Copy link

Ayfri commented Jun 11, 2021

Maybe it's because I'm using a plugin, here are the complete logs :

"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run generate --scripts-prepend-node-path=auto

> pixi-extended-docs@1.0.0 generate
> typedoc --sourcefile-url-map mappings.json
Warning: C:\Users\Pierre\WebstormProjects\pixi\PIXI-utils\node_modules\typedoc-plugin-sourcefile-url uses a deprecated structure. Pl
ugins should export a "load" function to be called with the Application
    at Application.bootstrap (C:\Users\Pierre\WebstormProjects\pixi\PIXI-utils\node_modules\typedoc\dist\lib\application.js:156:17)
Info: Loaded plugin C:\Users\Pierre\WebstormProjects\pixi\PIXI-utils\node_modules\typedoc-plugin-sourcefile-url
Error: source/src/sprites/Text.ts:17:18 - error TS2612: Property 'background' will overwrite the base property in 'Container'. If th
is is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

17  public override background: Sprite;
                    ~~~~~~~~~~


Process finished with exit code 3

@krisztianb
Copy link
Contributor

Can you temporarily disable or remove the plugin and try without it? Although I doubt that the plugin is the issue.

I think we should move this conversation to a new/separate issue.

@Ayfri
Copy link

Ayfri commented Jun 12, 2021

It doesn't fix the issue :/

Maybe yes.

@iliubinskii
Copy link

Using typedoc 0.21.0-beta.2 with typedoc-plugin-markdown 3.9.0.
It works well.

Curious when 0.21.0 can be expected?
typedoc-plugin-markdown has peer dependency ">=0.20.0" and does not see 0.21.0-beta.2.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 13, 2021

I'm aiming to release it tonight, assuming I have enough time, if not tonight, it should be sometime this week, Friday at the latest.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 15, 2021

(Obviously didn't happen yesterday, or today... 4 things left on todo list - https://github.com/TypeStrong/typedoc/projects/8)

@Gerrit0 Gerrit0 pinned this issue Jun 15, 2021
@krisztianb
Copy link
Contributor

@Gerrit0 take your time. 👍

@cefn
Copy link

cefn commented Jun 17, 2021

Depending on the beta works for @lauf/store and @lauf/store-react Thanks!

Typedoc retiring support for EOL Node 10 has prompted me to tidy up my test build matrix too!

Thanks for all your efforts.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 18, 2021

0.21.0 has been released!

@Gerrit0 Gerrit0 closed this as completed Jun 18, 2021
@Gerrit0 Gerrit0 unpinned this issue Jun 18, 2021
@nisimjoseph
Copy link

Working great! Thank you!

@doberkofler
Copy link
Author

Thank you!

@iliubinskii
Copy link

Thx. Great work 👍

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