-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Skip type checking by default #11340
Comments
It's a big change and seems rushed but I think I'm fine with it as long as it's in a major release.
This seems overly optimistic, this is such a big change in how the CLI works that it really should be major release (2.0) imo.
Is And just want to stress again, I'm not that agains the change itself but we cannot under any circumstance change such a fundamental thing in a minor release. |
It has been discussed since Nov 2020. That does not fit my definition of rushed.
While it is a significant change, it is one in the favour of the user. If it was a change the stuff that used to work broke, then I would be more concerned. The worst case is that what might not have run because of diagnostics will run and throw a runtime error. It does not impact what code is runnable under Deno, and it only requires a
Yes. This does not change the ideas behind #7732 which would be to have a single way to "type check" code in Deno. |
I don't see why we are changing Deno's defaults to target new users that may not use the runtime for more than a few minutes, Deno's defaults should be targeted at the people who use it daily and on a regular basis, not people just trying it out. Also, the main idea of Typescript is to have types, disabling type checking by defaults basically leaves useless type annotations that might aswell be JSDoc comments.
This can easily be solved by running with
Frankly I don't see this being a reality, most popular Deno libraries are well put together and I don't think its likely for new users to find bad libraries their first time using Deno. And I'm yet to see someone actually encounter such an issue.
Not sure why there's still This seems like a somewhat hasty decision without much solid reasoning and not much support from the community. And by hasty I mean that it was discussed for what amounts to few days back in November and December 2020 and there was no further discussion. |
Yes and I thought we had moved on from it back in November.
Shouldn't be treated any different than a programmatic API. For example, this command will break completely:
We've kept the old behaviour of all the stable flags for backwards compatibility in all the subcommands, even when it doesn't make sense. |
tl;dr: defaults should be the most common usecase, not a tailored specifically to increase user adoption (and only to increase user adoption) ok so... you could just suggest using realistically 99.9999% of users will not be hacking on multi-million line projects, and therefore typecheck time should be within, say, 10 seconds. it's far from instant but i believe the drastic increase in the probablity of things actually working will be worth the tradeoff for most people. i highly, highly doubt it would make much of a dent in user retention or whatever - this is not a website, so i believe there is no real decrease in ux with a one or two second delay. it's important to note:
|
This is a good decision, IMO. 👍 In Node.js world, I also don't want a full typecheck when running TypeScript code – that is reserved for an IDE or an explicit To be clear, we're quite strict when it comes to our codebase – TS is in Glad to see Deno thinking about it the same way, we already had |
Yes, this is the sanest default. Typesafe code is a nice aspiration, not a must-have. |
What? This issue disables typechecking for typescript by default, javascript does not have that ability. |
I'm in favor of this decision 👍 Deno subcommands have been very explicit with what they do. Eg: Similarly with this, |
@littledivy okay, sure, but what if i don't want the code to work if it isn't supposed to work in the first place? |
you're over-exaggerating. |
I disagree. I would expect |
ok so my viewpoint is, typechecking is slow, but that's about the only negative. typechecking is desirable behavior. there is almost no situation in which you'd want a program that semantically does not work to be running, and very few situations in which the 10 second, or one minute compile time is the difference between success and failure. basically:
|
@somebody1234 I don't know how Deno does it but even large Next.js projects transpile "immediately" because they do it per file – if I change (Per-file transpilation takes a few TS features away, most notably |
Next.js and Deno are massively different workloads, you're practically comparing frontend to backend, doesn't make much sense as a comparison and you have to keep in mind that Next.js also has the React build step to optimize for which would make skipping type checking much more reasonable, this build step more often than not does not exist in Deno. And Deno uses tsc for typechecking and swc for emit, this is faster than using just tsc for both type checking and emit, which is what Next.js would do if it did typechecking. |
When you start importing modules not written for Deno but run perfectly fine on Deno and the compliet start complaining about Again to be clear, if someone wants the existing behaviour, all the need to do is type |
We currently use the tsc emit when we type check, except when we bundle. We only use swc for individual modules when |
@kitsonk i don't know about you, but imo if the type definitions are definitely conflicting with something, i'd trust the compiler that has read the entire source of the library over someone just going "nah, trust me, it'l all be fiiiiiine" basically, if it "works perfectly fine", it shouldn't give type errors in the first place |
The only opinion I have is that we need this change to extremely obvious to every users. Maybe a warning each time you run a TS file without the —check flag or something like that. |
Type errors as warnings seems like a good compromise if core team isn't willing to not go forwards with this. |
I think this is the worst thing we can do. Seeing a wall of errors and then the output of your code is jarring for everyone, both the person who "just wants their code executed" and the person (more typical of those using a typed language in the first place) who wants their expectations to be met before anything is ever run. You either care about type errors at the moment or not. |
Fair, but we could address my concerns instead of dismissing a fleeting thought. |
I don't want to sound condescending, but if you haven't encountered type errors that have nothing to do with the type safety of your code, you haven't done enough Typescript, or enough Typescript with Deno. Many codebases are littered with We are not suggesting taking away type checking, we are suggesting it is not the default behaviour. And I won't name names, but it was a core Typescript team member who question why Deno type checked by default back almost a year ago that led to opening the discussion in the first place. |
Yes and that's fine, thats the purpose of |
I really don't understand why the solution for that problem isn't just to use JavaScript. If you're not gonna care about types, change the t for a j and voila. |
@ebebbington please also note that not everyone here is on the discord, and not everyone is awake at the same time, making discord the opposite of the ideal place to discuss. note also that there's a feature on github literally called discusssions, which would probably be a better place for this. edit: it seems that there is indeed a related discussion (#8549 ), we should probably just move all conversation there |
@peerreynders again, the issue is not about dynamic vs static typing. if you want dynamic typing, as said countless times above, just use javascript. re: not wanting to type check on every single pass, fun fact, you can pass |
@caspervonb my point still stands, all valid js code is valid ts code. this does not mean that there will be no ambiguities (like that case) - generic syntax in particular is infamous for being ambiguous |
@vwkd note that vim does have support for LSP, so deno LSP should work with relatively minimal changes (if any). note also that deno has its own language server which is considerably different from typescript's default, so "just using an IDE with typechecking" and "using the deno language server" will be considerably different in terms of development for example, one key point to note is that deno does not use DefinitelyTyped, and uses URL imports rather than node modules for dependencies (meaning any built-in typescript extension would almost certainly not work) |
@DefinitelyMaybe this one is just objectively false because vscode typechecks (and shows errors) for javascript by default, since its typescript extension is built in |
crosspost from the discussion. i'm fine with deleting this if activity at the discussion picks up again. since some people don't want to discuss in the issue, here's a summary of my viewpoint:
on common arguments for no typechecking being the default behavior:
on misc. other statements:
|
I am locking the conversation for now. We all appreciate the input, but I think people have stated their feelings, but we are repeating ourselves and not adding any new information. |
Unlocking to gather feedback on the experimental implementation in Deno 1.21 ( |
This can be closed |
Discussed in #8549
Originally posted by kitsonk November 30, 2020
Instead of
--no-check
consider type checking TypeScript as an opt-in with a--check
option.The core team has discussed this and reviewed the feedback from the community. Based on that, we are going to move forward with the following:
--check
flag will be implemented for the appropriate subcommands. This will use the built-intsc
for type checking and usetsc
for the emit (except for bundles where we will useswc
). We may in the future useswc
for the emit here as well. This is basically the current default behaviour of Deno.--no-check
flag will be deprecated and issue a warning that it is deprecated. The behaviour will not change from its current for now.swc
(this is basically the behaviour of--no-check
now).We will raise the PRs necessary to implement this and tentatively aim to introduce this in 1.13.
Why are you doing this?
The goal of the Deno CLI is to be a fun and productive scripting language. A user should be able to hack on some code and quickly see the results of their endeavour. The more "hurdles" that are in the way, the less fun and productive the experience becomes. We ❤️ TypeScript, we want people to use TypeScript more and more, but there are two major challenges with that:
--no-check
takes under 100ms.While on the surface it might seem like we are "watering" down Deno, we are motivated to make it easier to use Deno. If you are just starting out, maybe not having used TypeScript in strict mode before, or are just trying to hack a few lines of TypeScript and don't have all of your type annotations right, or you have imported a 3rd party library whose globals conflict with another 3rd party library, you have to spend all your time sorting that out to just find out if your code runs. Again, that isn't fun for anyone and certainly isn't productive.
Also, we have tried to put a lot of effort into the language server, and realistically that is where most people type check their code anyways, in their editor, which means to the majority of people type checking is not the default need they have when running on the command line. It is something they need as a final check, maybe in their CI, maybe before they commit, not every time they want to see if the code runs.
So, we acknowledge that in the discussion there wasn't overwhelming broad support for this, but we think we need to do this not for those already using Deno on a daily basis, but for those experimenting with Deno and TypeScript.
The text was updated successfully, but these errors were encountered: