Error: Expected a symbol for node with kind
previously, typedoc worked great with our monorepo in the main branch.
we expect it to compile correctly
note: the actual typescript compilation is working fine. all the project references compile correctly.
when we merged a feature branch that uses export * from './module-path, typedoc is having a parser error on that file.
Mapping /graphiql/packages/graphiql/src/api/index.ts ==> graphiql
/graphiql/node_modules/typedoc/dist/lib/converter/context.js:55
throw new Error(`Expected a symbol for node with kind ${ts.SyntaxKind[node.kind]}`);
^
Error: Expected a symbol for node with kind StringLiteral
at Context.expectSymbolAtLocation (/home/rikki/projects/graphiql/node_modules/typedoc/dist/lib/converter/context.js:55:19)
the file in question looks like this:
export * from './providers/GraphiQLEditorsProvider';
export * from './providers/GraphiQLSessionProvider';
export * from './providers/GraphiQLSchemaProvider';
export * from './hooks';
export * from './types';
this occurs with or without third party plugins, such as typedoc-monorepo-plugin which we were using successfully before this PR merge.
I cannot seem to reproduce the bug in a simplified, non-monorepo context:
https://github.com/acao/typedoc-export-bug-example
export * from 'module-path' seems to work fine with tsdoc in this case.
but in https://github.com/graphql/graphiql/ that is not the case
steps:
yarnyarn buildyarn build-docsYou likely can't reproduce this in a simplified context because there aren't compiler errors in your simple context. Turn off ignoreCompilerErrors and you will almost certainly see an error about TypeScript not being able to find the module. See #1293.
That said... I followed your repro steps, and upgraded typedoc, and am unable to reproduce your problem, the generated documentation is empty, but that's a separate problem... (Likely related to #1265, haven't had enough time to work on this lately)
ignoreCompilerErrors is already set to true:
https://github.com/graphql/graphiql/blob/master/typedoc.json#L15
thank you! i'll keep looking into it
you followed repro steps for the graphql/graphiql repo?
here are the changes you mentioned, still not working for typedoc bin locally. (the netlify failure is unrelated)
https://github.com/graphql/graphiql/pull/1585/files
ignoreCompilerErrors is already set to true:
Yes, and this is a problem. Doing this means that if there are compiler errors, TypeDoc will likely crash, since the TypeScript API doesn't necessarily follow its API contract if there are errors.
Yes, I used graphql/graphiql, checked out master. I also tried checking out your branch. Now that I'm looking at it with fresh eyes, a few things look odd.
inputFiles, I'm surprised that ever worked. TypeDoc doesn't support globs there, only files and directories... though that's being entirely ignored anyways (again unless the monorepo plugin does something strange) due to the bug fixed by #1265.prepublishOnly script, the prepublish script could be changed to that to avoid running it on install (only reason I knew it tried to run is I'm on Windows, and instead of running the script... cmd.exe will open the file in the default text editor)'packages' passed as the first argument, which results in it not finding any input files... and it silently ignores that. #1233.--tsconfig packages/graphiql fixes this, but results in another problem... now TS complains about files being outside of the rootDir. I modified paths to only look at packages/graphiql/src, which fixed that...
node_modules/typedoc/dist/lib/application.js
+129 const supportsJson = this.options.getCompilerOptions().resolveJsonModule;
+152 } else if (supportsJson && file.endsWith('.json')) {
+153 files.push(file)
+154 }
thank you for digging in so deeply on this! many things i can improve on here
here is the last working build:
https://5ee2586531b6070008b2c313--graphiql-test.netlify.app/typedoc/
and the last working ref:
https://github.com/graphql/graphiql/tree/294fd834efe485132744c0cd9d24690a61b45501
which is essentially the same as 1.0.0 branch
I'm going to dig in further today based on your notes and get back to you. i really really appreciate all the time you've taken to help me with this. we published a new monaco-mode and now the api docs are broken so this will be very helpful to many users!