-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
dev script creates unnecessary env.d.ts file #6013
Comments
Hey @lukeshiru! Yes, we now auto-generate an |
Hi @bholmesdev! Thanks for taking this to the maintainers! For now, I added that file to my If y'all need an extra set of hands to figure this out, let me know. Happy to help! |
@lukeshiru Understood! Speaking with core, we agree that Still, I'm curious why your project must exclude this file. Is it preference, or are they're technical reasons an |
@bholmesdev is almost a "preference" thing, but not quite:
To clarify, I always use TypeScript (used it since it was released back in 2012), so it is not that I'm a vanilla JS dev complaining about TS, but more of a TS dev with a concern about incorrect configs and a "not bad, but definitely weird DX". |
@lukeshiru Understood. To respond to each of those points:
And I recognize this isn't well-documented behavior. I think our TypeScript docs should clearly call out how Once this is documented, I plan to close as a "will not fix." We can reopen if a more compelling reason to skip |
The reason we use To quote TypeScript's documentation:
That means that by default, just installing, ex: |
Oh ok, I get it. The decision of using an extra file instead of using the configs that are already there is mainly to avoid breaking the implicit import of global types (such as I thought that maybe creating that file if is not there every time But no worries then, I have the workaround for my setup, so in my Astro projects I'll just keep that file in my Thanks for explaining your reasoning behind the decision, folks! I love what you're doing with Astro, thanks a lot for all your work! ✨ |
Can this not be configurable? I like to maintain all my |
Another weird thing – this file shouldn't be there when you don't use typescript, but for some reason it is) |
Astro is TypeScript only. Without this file you'd get editor errors when importing certain things / using certain APIs. |
Original concern is the tool messing up with user's repository because of some internal machinery. A minor distraction, yes, to go and exclude it from VCS, but again, still a distraction. |
Any update on this? I can confirm that the behaviour of generating |
You can configure your editor to hide the file if you want. Astro is TypeScript only and this file (or an equivalent) is necessary to power several of Astro's features. It's unlikely we'll get rid of it, or if we do, we'd just move it somewhere else. |
Sounds nice, it's a practice that I do in Remix to move cache into node_modules/remix. can it be moved to |
We can't really move it to There's no settings to change this at this time, maybe in the future we'll do something, but this is very low priority since most people don't really mind |
I see, I see. Can the issue still be remained open though? It still feels like a teeny-tiny minor improvement over default behaviour not worthy of getting forgotten in a closed issue. |
We reserve our issue tracker for technical issues, for suggestions feel free to create a discussion on our roadmap repo: https://github.com/withastro/roadmap so that the community can vote on it and we can prioritize it if it becomes popular |
I don't like this file. How to get rid of it? |
We are adding MDX files to `.gitignore` for now since they are just a result of a build process, once the migration is done, we will not ignore them. We're using PNPM workspaces to manage this project. The new project's tsconfig.json has been copied from the current root tsconfig.json while omitting some details that are only relevant to that project. `help-beta/src/env.d.ts` is a type declaration file auto-generated by Astro. See withastro/astro#6013.
The issue with placing the type import in a However, my understanding is that In my case, I want to use Astro in a project that employs project references to separate type checking of client-side code, server-side code, node helper scripts, test code, stories etc. While Long story short: I'd vote for not creating an For now I'll probably work around this by explicitly |
We are adding MDX files to `.gitignore` for now since they are just a result of a build process, once the migration is done, we will not ignore them. We're using PNPM workspaces to manage this project. The new project's tsconfig.json has been copied from the current root tsconfig.json while omitting some details that are only relevant to that project. `help-beta/src/env.d.ts` is a type declaration file auto-generated by Astro. See withastro/astro#6013.
We are adding MDX files to `.gitignore` for now since they are just a result of a build process, once the migration is done, we will not ignore them. We're using PNPM workspaces to manage this project. The new project's tsconfig.json has been copied from the current root tsconfig.json while omitting some details that are only relevant to that project. `help-beta/src/env.d.ts` is a type declaration file auto-generated by Astro. See withastro/astro#6013.
We are adding MDX files to `.gitignore` for now since they are just a result of a build process, once the migration is done, we will not ignore them. We're using PNPM workspaces to manage this project. The new project's tsconfig.json has been copied from the current root tsconfig.json while omitting some details that are only relevant to that project. `help-beta/src/env.d.ts` is a type declaration file auto-generated by Astro. See withastro/astro#6013.
We are adding MDX files to `.gitignore` for now since they are just a result of a build process, once the migration is done, we will not ignore them. We're using PNPM workspaces to manage this project. The new project's tsconfig.json has been copied from the current root tsconfig.json while omitting some details that are only relevant to that project. `help-beta/src/env.d.ts` is a type declaration file auto-generated by Astro. See withastro/astro#6013.
I installed then removed typescript. But the env.d.ts file keeps getting generated upon build. How can I disable that? I don't think I need it. |
Check #11859, |
What version of
astro
are you using?2.0.2
Are you using an SSR adapter? If so, which one?
vercel
What package manager are you using?
pnpm
What operating system are you using?
MacOS
Describe the Bug
When running
pnpm dev
to run the server locally on an existing Astro project of mine I just upgraded, the script creates a newenv.d.ts
file in mysrc
folder, with this on it:/// <reference types="astro/client" />
This is not necessary at all because my
tsconfig.json
file already has acompilerOptions.types
(more about this option here) set to useastro/client
:The
dev
script shouldn't create that file in every run, and even less so if already included the types intsconfig.json
. If we agree creating new files in each run ofdev
is not good, I'm willing to take a look at said script in astro's code and fix it for you, or even update thetsconfig.json
orjsconfig.json
file you generate to include the types there.Link to Minimal Reproducible Example
https://gist.github.com/lukeshiru/a171e9fdd0c9b78296fbd41f2fef1373
Participation
The text was updated successfully, but these errors were encountered: