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

Wrong import path for types.d.ts ContentConfig #9673

Closed
1 task done
loucyx opened this issue Jan 12, 2024 · 2 comments · Fixed by #9680
Closed
1 task done

Wrong import path for types.d.ts ContentConfig #9673

loucyx opened this issue Jan 12, 2024 · 2 comments · Fixed by #9680
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@loucyx
Copy link
Contributor

loucyx commented Jan 12, 2024

Astro Info

Astro                    v4.1.2
Node                     v21.5.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/vercel
Integrations             @astrojs/sitemap
                         @astrojs/tailwind
                         astro-expressive-code

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

The types generated from packages/astro/src/content/types-generator.ts generate a ContentConfig type that looks like this:

type ContentConfig = typeof import("../src/content/config");

The issue with it is that if our tsconfig.json has verbatimModuleSyntax set to true, that import is invalid because it doesn't have the file extension, so we end up with any instead of the strong type we wanted. If instead, that import was written like this:

type ContentConfig = typeof import("../src/content/config.js");

Then it would work in all cases.

What's the expected result?

Get the proper type for my content, right now I'm getting any for it.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/verbatim-module-issue?file=src%2Fpages%2Frss.xml.js

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 12, 2024
@loucyx
Copy link
Contributor Author

loucyx commented Jan 12, 2024

I would create a PR directly for packages/astro/src/content/types-generator.ts:468 but I wanted to check with you folks to see how you prefer to solve this issue, because adding a .js on that string would fix it, but maybe you have an util for that already.

@bluwy
Copy link
Member

bluwy commented Jan 12, 2024

Adding .js seems harmless to me and should work in all TS versions. Feel free to contribute the fix!

@bluwy bluwy added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Jan 12, 2024
@florian-lefebvre florian-lefebvre linked a pull request Jan 12, 2024 that will close this issue
ematipico pushed a commit that referenced this issue Jan 24, 2024
* Fix for #9673

* 🦋 add changeset file

* Update breezy-plants-smoke.md

Co-authored-by: Florian Lefebvre <[email protected]>

* ⚡️ simplified normalizeConfigPath

---------

Co-authored-by: Florian Lefebvre <[email protected]>
ematipico pushed a commit that referenced this issue Jan 25, 2024
* Fix for #9673

* 🦋 add changeset file

* Update breezy-plants-smoke.md

Co-authored-by: Florian Lefebvre <[email protected]>

* ⚡️ simplified normalizeConfigPath

---------

Co-authored-by: Florian Lefebvre <[email protected]>
ematipico added a commit that referenced this issue Jan 31, 2024
* i18n(domains): validation and updated logic (#9099)

* feat(i18n): domain with lookup table (#9112)

* chore: add changelog, fix types and enable experimental support in node/vercel

* rebase and update lock file

* chore: fix failing test

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by:  Matthew Phillips <[email protected]>

* Update .changeset/tidy-carrots-jump.md

Co-authored-by: Sarah Rainsberger <[email protected]>

* wip

* chore: rebase, conflicts and tests

* update lock file

* chore: correct configuration

* chore: correct configuration

* fix: regressions

* chore: fix conflicts and add more tests

* chore: add more validation

* chore: more tests and add more restrictions

* fix changeset

* change and revert adapters

* add another restriction

* lock file update

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Bjorn Lu <[email protected]>

* wat

* fix syntax error

* fix config example

* Fix for #9673 (#9680)

* Fix for #9673

* 🦋 add changeset file

* Update breezy-plants-smoke.md

Co-authored-by: Florian Lefebvre <[email protected]>

* ⚡️ simplified normalizeConfigPath

---------

Co-authored-by: Florian Lefebvre <[email protected]>

* Fix env var replacement for export const prerender (#9807)

* feat(alpinejs): allow customizing the Alpine instance (#9751)

* feat(alpinejs): allows customzing the Alpine instance

* chore: add e2e tests

* fix: rename script

* Update index.ts

* fix: lockfile

* [ci] format

* chore: use correct lock file

* chore: rebase

* fix regressions in tests

* fix regressions in tests

* fix build

* add description

* fix missing types

* chore: fix tests, again :D

* eslint

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Nate Moore <[email protected]>

* chore: address feedback

* chore: fix regressions

* chore: refactor naming

* Update packages/astro/src/core/app/index.ts

Co-authored-by: Bjorn Lu <[email protected]>

* chore: address feedback

* update lock file

* chore: infer routing from options, not strategy

* merge from main

* merge from main

* Experimental support in vercel adapter

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* Update .changeset/tidy-carrots-jump.md

Co-authored-by: Sarah Rainsberger <[email protected]>

* better changesets

* Updates both experimental.i18nDomains and i18ndomains for experimental strategy

* fix link syntax

* consistent tabs/spaces

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <[email protected]>

* apply suggestion

---------

Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Matthew Phillips <[email protected]>
Co-authored-by: Bjorn Lu <[email protected]>
Co-authored-by: Lou Cyx <[email protected]>
Co-authored-by: Florian Lefebvre <[email protected]>
Co-authored-by: Florian Lefebvre <[email protected]>
Co-authored-by: Nate Moore <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants