Comments (3)
PS: But I would expect
create-astro
to have a flag--no-typescript
(like for the other similar flags).
Astro always uses TypeScript. No matter what you chose your code will be processed using a TS compiler.
Answering "no" to the "Do you plan to write TypeScript?" question doesn't mean "disable TypeScript". It causes the generated project to not use the strictest TS config, which outright forbids plain JS files. It will still run TS but allow untyped JS files in the project.
Now, if you plan to write TypeScript and want it to be more forgiving than the default settings, you can choose the relaxed TS config preset. If you are only writing JS files, those two (strict and relaxed) do the same thing, so the current behavior is just fine. If you are also writing TS files and want them relaxed, then the answer to "Do you plan to write TypeScript?" is not "no" is it? You see the option to set TS to relaxed only if you intend to use TS in the first place.
from astro.
I think supporting --no-typescript
and --no
to also disable typescript makes sense to me. I don't know if there's a previous reasoning behing strict as default in this case though. The default is set at
astro/packages/create-astro/src/actions/context.ts
Lines 78 to 83 in 19adfaa
from astro.
Thanks @Fryuni. That explains why there's still a tsconfig.json with "base" 😁
I guess things got mixed up in my mind when I saw that some projects were ditching TS and I don't remember if Astro actually did or if it's just me who decided to create Astro projects without TS and therefore was expecting a JS project template.
While on that topic. If Astro uses TS anyway, if we use relaxed, what's the best practice for the files we create? Always use .ts? Or does it make sense to use .js and .mjs?
from astro.
Related Issues (20)
- Astro dev server not running with bun HOT 1
- Vite Config cspNonce HOT 2
- Custom lit converter not being called
- `astro check` checks `dist` HOT 1
- Cursor Flickers Between Pointer and Arrow During Route Transitions with `astro:transitions`
- Astro.slots.render() with arguments does not work with Astro component HOT 2
- Astro actions cookies broken, too large sometimes HOT 2
- import.meta.env.MODE resolved to "development" for production builds on build stage HOT 3
- Astro actions not validate fields without client side HOT 1
- Error building Astro project with 30k MDX files HOT 2
- Astro devToolbar throws "Uncaught TypeError: Illegal constructor" HOT 1
- i18n and rewrites do not output the right files HOT 3
- Build doesn't fail even though there are unhandled exceptions
- [Actions] Zod object.passthrough does not allow extra input keys/values
- Dynamic attribute isn't recognized by Tailwind unless there's at least one exact concrete implementation HOT 1
- Using React component inside MDX file fails with Container API HOT 1
- New build error - Astro 4.13.4 HOT 8
- Dynamic import and rendering of Framework component throws Could not render `ComponentName`. No matching import has been found for `ComponentName` HOT 3
- Server Islands does not seem to work with basepath HOT 6
- MDX with frontmatter reports errors on wrong line
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro.