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

Type check errors running tsc --noEmit #268

Closed
didavid61202 opened this issue Jun 4, 2022 · 0 comments · Fixed by #269
Closed

Type check errors running tsc --noEmit #268

didavid61202 opened this issue Jun 4, 2022 · 0 comments · Fixed by #269

Comments

@didavid61202
Copy link
Contributor

didavid61202 commented Jun 4, 2022

Environment

Node: v16.13
Nitropack: v0.4.4

Reproduction

open the following Stackblitz clone repo will automatically run tsc --noEmit start command, then errors are logged in the Terminal panel.
https://stackblitz.com/edit/github-tkzhuy?file=.stackblitzrc

Describe the bug

After running type check using typescript's tsc --noEmit commands, shows the following errors:

Errors  Files
     1  examples/cached-handler/routes/index.ts:1
     1  examples/custom-error-handler/routes/index.ts:1
     1  examples/plugins/plugins/test.ts:1
     1  src/presets/aws-lambda.ts:5
     1  src/presets/azure-functions.ts:12
     1  src/presets/azure.ts:10
     1  src/presets/firebase.ts:12
     1  src/presets/node.ts:5
     1  src/presets/stormkit.ts:5
     1  src/runtime/app.ts:43
     2  src/runtime/cache.ts:44
     1  src/runtime/client.ts:5
     1  src/runtime/entries/cloudflare.ts:30
     2  src/runtime/entries/netlify-edge.ts:16
     3  src/runtime/entries/service-worker.ts:33
     1  src/runtime/utils.ts:16
     1  test/fixture/api/kebab.ts:1
     1  test/fixture/api/param/[id].ts:1
     1  test/fixture/api/wildcard/[...param].ts:1
     1  test/fixture/routes/prerender.ts:3
     1  test/tests.ts:74

Errors can be separated into 3 parts:

  1. examples/ directory: .nitro folder wasn't built yet for examples in the examples/, which we can ignore for 'source code type checking' as end-users will build those types correctly when they are building those examples.
  2. test/ directory: also missing .nitro folder with corresponding types, which we should ignore for test/fixture as it can have its own tsconfig.json for type checks. (can be partially fix with feat: enable response type infer for API routes with params #222)
  3. src/ directory: most type errors occurs, some are due to global type's name collision, some are missing discriminating union or mismatch input value.

Additional context

No response

Logs

No response

corresponding PR: #269

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

Successfully merging a pull request may close this issue.

1 participant