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 hints not working as designed, missing tsconfig include path #204

Closed
didavid61202 opened this issue May 6, 2022 · 1 comment · Fixed by #205
Closed

type hints not working as designed, missing tsconfig include path #204

didavid61202 opened this issue May 6, 2022 · 1 comment · Fixed by #205

Comments

@didavid61202
Copy link
Contributor

didavid61202 commented May 6, 2022

Environment

Nitro: Latest
Node: v16.13.0

Reproduction

clone and run pnpm dev: https://github.com/didavid61202/nitro-app

go to routes/index.ts, and typescript will throw an error: Cannot find name 'eventHandler'. and type hints are not working as designed.

Describe the bug

the generated tsconfig.json file in .nitro/types is missing "include path" of relative path of the nitro.config.buildDir to the nitro.config.rootDir/srcDir ("../../**/*" when using basic config setup), causing typescript unable to grab all global types defined in .nitro/types/nitro.d.ts.

adding relative path of the nitro.config.buildDir to the nitro.config.rootDir/srcDir to tsConfig.include array in nitro\src\build.ts should fix this issue.

can be fix by #205

Additional context

No response

Logs

No response

@pi0
Copy link
Member

pi0 commented May 6, 2022

/cc @danielroe

didavid61202 added a commit to didavid61202/nitro that referenced this issue May 6, 2022
…itrojs#204)

the generated tsconfig.json file in .nitro/types is missing "include path" of "../../**/*", causing typescript unable to grab all global types defined in .nitro/types/nitro.d.ts.  adding "../../**/*" to tsConfig.include array in nitro\src\build.ts should fix this issue.
@pi0 pi0 closed this as completed in #205 May 9, 2022
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.

2 participants