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

feat: Throw a better error message when using wrong imports #467

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

mrousavy
Copy link
Owner

@mrousavy mrousavy commented Jan 8, 2025

When doing this:

import { SomeType } from '@src/SomeType'

Nitrogen might not know where to import SomeType from because @src is a path alias created from the user's tsconfig.json.

Nitrogen does not use the user's tsconfig.json though, so it has to be imported like this instead:

import { SomeType } from '../SomeType'

This will work.

This PR now throws a better error message in these situations:

- The TypeScript type "SomeType" cannot be represented in C++!
+ The TypeScript type "SomeType" cannot be resolved - is it imported properly? Make sure to import it properly using fully specified relative or absolute imports, no aliases.

Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
nitro-docs ⬜️ Skipped (Inspect) Jan 8, 2025 10:39am

@mrousavy mrousavy mentioned this pull request Jan 8, 2025
3 tasks
@mrousavy mrousavy merged commit 96e7716 into main Jan 8, 2025
7 checks passed
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 this pull request may close these issues.

TS/JS module path aliases don't work
1 participant