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

dx: be more explicit with emitSkipped error #395

Merged
merged 1 commit into from
Aug 8, 2022

Conversation

agilgur5
Copy link
Collaborator

@agilgur5 agilgur5 commented Jul 22, 2022

Summary

Provide a bit more details when erroring on emitSkipped and link to my TS issue since this is unfortunately undocumented

Details

  • a few issues have reported that "failed to transpile" is a vague / confusing error
  • so explicitly say "Emit skipped" instead, which is slightly less vague, in that it can actually be used as a search term
    • and provide a link to my TS issue that lists some reasons why emitSkipped occurs, since this is unfortunately otherwise undocumented by TS
      • in the future, hopefully that issue will be resolved and we'll be able to give better or more specific error messages, but for now this is probably the best we can do due to its undocumented nature, unfortunately

- a few issues have reported that "failed to transpile" is a vague / confusing error
  - and `emitSkipped` actually _doesn't_ mean that it failed to transpile, as, in current versions of TS, it's not due to syntactic or semantic errors
- so explicitly say "Emit skipped" instead, which is slightly less vague, in that it can actually be used as a search term
  - and provide a link to my TS issue that lists some reasons why `emitSkipped` occurs, since this is unfortunately otherwise undocumented by TS
    - in the future, hopefully that issue will be resolved and we'll be able to give better or more specific error messages, but for now this is probably the best we can do due to its undocumented nature, unfortunately
@agilgur5 agilgur5 added topic: TS Compiler API Docs Related to the severely lacking TS Compiler API Docs kind: dx Improvements to dev experience, e.g. error messages, logging, external-facing docs, etc labels Jul 22, 2022
@ezolenko ezolenko merged commit 4d20f5c into ezolenko:master Aug 8, 2022
@agilgur5
Copy link
Collaborator Author

Hmm... so with latest rpt2 0.33.0 on #254 I was still getting emitSkipped despite all the fixes. I added some logging and saw something interesting:

❯ npx rollup -c

src/runtime/navigation/index.ts, src/runtime/stores/index.ts → assets/runtime...
{
  outputFiles: [],
  emitSkipped: true,
  diagnostics: [
    {
      file: [SourceFileObject],
      start: 617,
      length: 5,
      messageText: "Property 'route' of exported interface has or is using private name 'Route'.",
      category: 1,
      code: 4033,
      reportsUnnecessary: undefined,
      reportsDeprecated: undefined
    }
  ],
  exportedModulesFromDeclarationEmit: undefined
}
/rpt2-issue-254/packages/kit/src/runtime/navigation/index.ts
[]
[!] (plugin rpt2) Error: Emit skipped for '/rpt2-issue-254/packages/kit/src/runtime/navigation/index.ts'. See https://github.com/microsoft/TypeScript/issues/49790 for potential reasons why this may occur
src/runtime/navigation/index.ts

    at error (/rpt2-issue-254/node_modules/.pnpm/rollup@2.32.0/node_modules/rollup/dist/shared/rollup.js:5251:30)
    at throwPluginError (/rpt2-issue-254/node_modules/.pnpm/rollup@2.32.0/node_modules/rollup/dist/shared/rollup.js:17912:12)
    at Object.error (/rpt2-issue-254/node_modules/.pnpm/rollup@2.32.0/node_modules/rollup/dist/shared/rollup.js:18519:24)
    at Object.error (/rpt2-issue-254/node_modules/.pnpm/rollup@2.32.0/node_modules/rollup/dist/shared/rollup.js:18081:38)
    at /rpt2-issue-254/node_modules/.pnpm/rollup-plugin-typescript2@0.33.0_g55licvlyixydf5tadtvtnn3hq/node_modules/rollup-plugin-typescript2/src/index.ts:232:12
    at TsCache.getCached (/rpt2-issue-254/node_modules/.pnpm/rollup-plugin-typescript2@0.33.0_g55licvlyixydf5tadtvtnn3hq/node_modules/rollup-plugin-typescript2/src/tscache.ts:274:25)
    at TsCache.getCompiled (/rpt2-issue-254/node_modules/.pnpm/rollup-plugin-typescript2@0.33.0_g55licvlyixydf5tadtvtnn3hq/node_modules/rollup-plugin-typescript2/src/tscache.ts:213:15)
    at Object.transform (/rpt2-issue-254/node_modules/.pnpm/rollup-plugin-typescript2@0.33.0_g55licvlyixydf5tadtvtnn3hq/node_modules/rollup-plugin-typescript2/src/index.ts:222:16)
    at /rpt2-issue-254/node_modules/.pnpm/rollup@2.32.0/node_modules/rollup/dist/shared/rollup.js:18718:25

In this case, there are diagnostics with the output. But typecheckFile doesn't output anything.

That's because the type error is in types.ts instead of index.ts (per the issue).
But index.ts gets a different diagnostic error because of that type error apparently, and it appears to be neither a syntactic nor a semantic error, oddly enough... 🤔 It also doesn't show up in tsc's output.

This might be a TS bug upstream? I'm really not sure... 😕

@agilgur5 agilgur5 deleted the dx-emit-skipped-error branch July 2, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: dx Improvements to dev experience, e.g. error messages, logging, external-facing docs, etc topic: TS Compiler API Docs Related to the severely lacking TS Compiler API Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants