Giter Site home page Giter Site logo

Comments (3)

Fryuni avatar Fryuni commented on August 15, 2024 1

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.

bluwy avatar bluwy commented on August 15, 2024

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

if (no) {
yes = false;
if (install == undefined) install = false;
if (git == undefined) git = false;
if (typescript == undefined) typescript = 'strict';
}

from astro.

ppo avatar ppo commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.