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

Error TS5053 about 'noEmit' when noEmit isn't configured #1716

Closed
fenomas opened this issue Sep 29, 2021 · 6 comments
Closed

Error TS5053 about 'noEmit' when noEmit isn't configured #1716

fenomas opened this issue Sep 29, 2021 · 6 comments
Labels
bug Functionality does not match expectation good first issue Easier issue for first time contributors help wanted Contributions are especially encouraged

Comments

@fenomas
Copy link

fenomas commented Sep 29, 2021

Search terms

TS5053, emitDeclarationOnly, noEmit

Expected Behavior

I'm building docs for a JS project, which uses tsc to emit type declarations, but not to compile anything. I'm invoking typedoc with the same config file, and things worked without errors under typedoc 0.20.

Actual Behavior

After updating typedoc to 0.22, when I run it I get the following error about noEmit, even though my configuration doesn't include that option.

Error: error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.

Steps to reproduce the bug

This is on OSX, node 16.8.0. My package versions are current as of today:

        "typedoc": "^0.22.4",
        "typescript": "^4.4.3",

And I'm running npx typedoc in a folder containing the following tsconfig.json:

{
    "include": [ "src/index.js" ],
    "compilerOptions": {
        "outDir": "./dist",
        "target": "es5",
        "declaration": true,
        "emitDeclarationOnly": true,
        "allowJs": true,
        "lib": [ "DOM", "DOM.Iterable", "ES2018" ]
    },
    "typedocOptions": {
        "entryPoints": [ "src/index.js" ]
    }
}

The JS code doesn't seem to be relevant - the error displays even if the entry point file contains nothing but comments.

Has something changed here from previous versions? I can avoid the error by removing the "emitDeclarationOnly": true, config option, but since I'm not using tsc as a compiler this would mean I'd need separate configs for tsc and typedoc. Is that the solution here?

Thanks!

@fenomas fenomas added the bug Functionality does not match expectation label Sep 29, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Sep 29, 2021

This was introduced with a fix for another bug - #1639, I forgot about emitDeclarationOnly. Should be an easy fix

@Gerrit0 Gerrit0 added help wanted Contributions are especially encouraged good first issue Easier issue for first time contributors labels Sep 29, 2021
@Gerrit0 Gerrit0 closed this as completed in f3ff7cf Oct 2, 2021
@nlfurniss
Copy link
Contributor

nlfurniss commented Oct 15, 2021

@Gerrit0

In my project I don't specify emit in the Typedoc options. When fixCompilerOptions is called via application.ts, the options are an empty object. fixCompilerOptions then adds noEmit to the object, which gets merged with the options from tsconfig and that config may contain emitDeclarationOnly, but because the TS options are not the options passed to fixCompilerOptions, it wasn't deleted as intended and a S5053 error is thrown.

To work 100%, it seems like this function would need to change the value of emitDeclarationOnly that's set on the container, but I'm not sure if that's possible. Or possibly if the options are an empty object, not to add noEmit.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Oct 16, 2021

Ah shoot, that's annoying. I forgot about watch mode doing weird things... It looks like watch mode doesn't currently support emitting files at all, which is probably another bug.

@Gerrit0 Gerrit0 reopened this Oct 16, 2021
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Oct 16, 2021

Turns out that watch mode is more broken than I thought... yeah, it technically allows watching... but it doesn't actually use the watch program when doing conversion, so it is unnecessarily slow..

@chriskrycho
Copy link

@Gerrit0 can you elaborate on this?

but it doesn't actually use the watch program when doing conversion, so it is unnecessarily slow

I’ve been starting to evaluate whether/how to use the watch mode in conjunction with project references over in ember-cli-typescript and this comment has me very 😬

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Oct 19, 2021

68d5cbd fixed that :) the call to getEntryPoints wasn't passing in currentProgram, so that function was creating new programs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation good first issue Easier issue for first time contributors help wanted Contributions are especially encouraged
Projects
None yet
Development

No branches or pull requests

4 participants